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

[cms-sanity] Add NEXT_PUBLIC_ to readme env variables #14792

Closed
Maybach91 opened this issue Jul 2, 2020 · 1 comment · Fixed by #14941
Closed

[cms-sanity] Add NEXT_PUBLIC_ to readme env variables #14792

Maybach91 opened this issue Jul 2, 2020 · 1 comment · Fixed by #14941
Assignees
Milestone

Comments

@Maybach91
Copy link

Bug report

Describe the bug

Step 4 of the readme says, i have to create a env variable named SANITY_PROJECT_ID but to work locally with yarn dev it has to be NEXT_PUBLIC_SANITY_PROJECT_ID (as well?)

Since i was not aware of this part of the next.js config, i was confused why it wasn’t working. Since i could access all env variables within my code, but not on runtime.

To Reproduce

Follow the steps of the Readme to install & run the example.

Expected behavior

Follow the readme and have a functioning project running with yarn dev

Screenshots

Without the NEXT_PUBLIC_SANITY_PROJECT_ID variable in the .env.local file:
image

System information

  • OS: macOS
  • Browser: Chrome
  • Version of Next.js: v9.4.4
  • Version of Node.js: v.13.8.0
@Timer Timer added this to the iteration 4 milestone Jul 2, 2020
Maybach91 added a commit to Maybach91/next.js that referenced this issue Jul 3, 2020
* To run nextjs and sanity locally we need to define a `NEXT_PUBLIC_SANITY_PROJECT_ID` as environment variable. [reference](https://nextjs.org/docs/basic-features/environment-variables#exposing-environment-variables-to-the-browser)

* Also use this variable only, when run in development node environment.

[14792](vercel#14792)
Maybach91 added a commit to Maybach91/next.js that referenced this issue Jul 3, 2020
…hema file

To avoid confusion why there are two folders with the same name within the whole project, we should add the `example` to the schema file which is only used to store within the project to copy it to sanity after successful installation.

[14792](vercel#14792)
@kodiakhq kodiakhq bot closed this as completed in #14941 Jul 8, 2020
kodiakhq bot pushed a commit that referenced this issue Jul 8, 2020
Fixes #14792
Closes #14814

The project id is currently used by Sanity's image builder, which is used in a React component.

@maybac It was faster for me to create a new PR but the credit goes to you, thank you!.
rokinsky pushed a commit to rokinsky/next.js that referenced this issue Jul 11, 2020
Fixes vercel#14792
Closes vercel#14814

The project id is currently used by Sanity's image builder, which is used in a React component.

@maybac It was faster for me to create a new PR but the credit goes to you, thank you!.
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants