I created a blog with contentful api in the client folder with the api keys located in the .env.devlopment file. I also have an .env file to hold my api keys for cloudinary in the same client folder. I can see all of my content and upload audio when I tested out my react site but i have problem when running npm run build
in the terminal. I have no errors in the localhost but I receive an error of Expected parameter accessToken
when I prepare to deploy to heroku. i removed ReactDOM
from ReactDOM.render in my index.js file and i get a question about replacing the call to ReactDOM.render.
contentful.js file:
import {createClient} from 'contentful';
export default createClient({
space: process.env.REACT_APP_API_SPACE,
accessToken: process.env.REACT_APP_ACCESS_TOKEN
});
.env.enviroment file:
REACT_APP_API_SPACE= my access key
REACT_APP_ACCESS_TOKEN= my access token
Error in terminal when i run npm run build
Error: Uncaught [TypeError: Expected parameter accessToken]
Object.t.createClient
'render' from react-snapshot was never called. Did you replace the call to ReactDOM.render()?
When I run console.log(process.env); I receive
console.log(process.env);
1. {NODE_ENV: "development", PUBLIC_URL: "", WDS_SOCKET_HOST: undefined, WDS_SOCKET_PATH: undefined, WDS_SOCKET_PORT: undefined, …}
1. FAST_REFRESH: true
2. NODE_ENV: "development"
3. PUBLIC_URL: ""
4. REACT_APP_API: "http://localhost:8000/api"
5. REACT_APP_CLOUDINARY_CLOUD_NAME: "********"
6. REACT_APP_CLOUDINARY_UPLOAD_SECRET: "*******"
7. REACT_APP_SPACE_ID: "*********"
8. REACT_APP_SPACE_TOKEN: "***********"
client.env
REACT_APP_API: "http://localhost:8000/api"
REACT_APP_CLOUDINARY_CLOUD_NAME: "********"
REACT_APP_CLOUDINARY_UPLOAD_SECRET: "*******"
client.env.development
REACT_APP_SPACE_ID: "*********"
REACT_APP_SPACE_TOKEN: "***********"