Open samyak1999 opened 2 years ago
Issue arose while using variables from .env file . How to import values from .env file into client.js ?
I have run into this same problem but if you remove the process.env.REACT.... and just put your projectId in as a string it will work but best practices doesnt allow this so apperantly what ive read is that it will work in production but in development you either have to change the .env to .env.example or development. and yes ive tried this aswell neither worked for me so just placed the token in the env and made it public string
Does your project have a .gitignore file in it?? If not create it. Use this for reference.
Now install the dependency
npm install dotenv --save
Next, add the following line to your app
require('dotenv').config()
Then delete the .env file and input the environment variables again... This should solve the issue...
Yes it does but plus I did try that but I ended with the same results the only thing that worked for me was this command in powershall or even in your vscode: ($env:REACT_APP_NOT_SECRET_CODE = "abcdef") -and (npm start)
if use yarn just change that bit. But I think it introduced a related bug or not I could be wrong. But thanks man managed to finish my app by then went with strapi insted
The solution to this is much more simple. The author uses REACTAPPSANITYPROJECTID=yourvalue. Just remove the extra underscores so it looks like this REACT_APP_SANITY_PROJECT_ID=yourvalue for both of the variables and remember to update them in the client.js as well and it should resume working.
The above error occurred(displayed in the console) when I tried to integrate sanity bank-end with the react app. React app starts with a blank screen with no error in terminal. I am unable to debug the issue.