Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Configuration must contain projectId #34

Open
samyak1999 opened this issue Jul 28, 2022 · 5 comments
Open

Uncaught Error: Configuration must contain projectId #34

samyak1999 opened this issue Jul 28, 2022 · 5 comments

Comments

@samyak1999
Copy link

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.

@samyak1999
Copy link
Author

Issue arose while using variables from .env file . How to import values from .env file into client.js ?

@CloAk-64bit
Copy link

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

@Anirudh-A-V
Copy link

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...

@CloAk-64bit
Copy link

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

@MagicFishgit
Copy link

MagicFishgit commented Nov 22, 2022

The solution to this is much more simple. The author uses REACT__APP__SANITY__PROJECT__ID=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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants