Hello folks! I have a Turborepo, and one of the packages is a nextjs app which I’m deploying with Vercel. I added some env vars on the dashboard, and when I do vercel env pull
the .env.local
file is dropped on the root on the project, but I then need to copy it manually to /apps/server
(the root of the nextjs project deployed on vercel). Is this the expected behaviour? What’s the correct procedure here?
Yes, that’s the expected behaviour. When you run vercel env pull
, the .env.local
file gets placed at the root of your Turborepo project. Since your Next.js app is under /apps/server
, you’ll need to manually move the .env.local
file there.
A more streamlined way would be to create a script that automates this step after pulling the environment variables. You could add a simple post-pull script to move the file automatically into /apps/server
.
You can specify a file in a subdirectory, like vercel env pull apps/server/.env.local
to pull the variables directly to that file instead of downloading and manually copying.
Hope that helps!
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.