One file to rule them all
.env
file.When first creating a new project for a client, all environment variables that are created should also be added to the environment variables list in the vercel account for the given project. (This can be found under the settings tab).
This allows other Gearbox team members to hop on the project if need be and easily add everything they need to their local environment through the Vercel CLI.
Install the CLI if you haven't already -> yarn global add vercel@latest
Link your project to it's Vercel instance -> vercel link
Type Y
to accept.
Select Vercel profile that contains the project (99% of the time it will be Gearbox Built
).
If it exists, it will prompt you to link to the project.
Once linked, you can use vercel env pull
to pull the environment variables.
❗Don't forget to run yarn install
before yarn start
❗
If you've followed all the steps above and still can't get it to work locally, make sure that all variables
that have the SANITY_STUDIO
prefix are listed at the end, to ensure proper injection at build time.
Move them to the end, then try again.