-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
kind: bugSomething isn't workingSomething isn't working
Description
What version of Turborepo are you using?
1.0.19
Describe the Bug
On Vercel I have a public environment variable set called NEXT_PUBLIC_SEGMENT_WRITE_KEY
. It's set to one value for production, and another for preview and development.
If I deploy a preview branch with the build command set to cd ../.. && yarn turbo run build --scope=website --includeDependencies --no-deps
and preview the site, the correct env var for preview/dev used.
But then if I then do a production deployment, the env var for preview/dev is still used. The env var is used within a function, within a component like this:
const renderSnippet = () => {
const opts = {
apiKey: process.env.NEXT_PUBLIC_SEGMENT_WRITE_KEY,
load: true,
page: true,
};
if (!opts.apiKey) {
return null;
}
return snippet.min(opts);
};
Clearing the build command so it's just the Next.js default restores the normal behaviour.
Expected Behavior
Correct production env var is picked up and used.
To Reproduce
- Create a public environment variable with different values for production and preview/development.
- Render
process.env.NEXTJS_PUBLIC_<var name>
to page.
magicspon, gf5901, nezz0746 and hugraverodsfreitas, devjmetivier, leolabs and nezz0746
Metadata
Metadata
Assignees
Labels
kind: bugSomething isn't workingSomething isn't working