S
Supabaseβ€’2mo ago
Polyglot

Vercel preview build isn't getting Supabase branch env vars

I am trying to get the Vercel preview deployments working with Supabase branches, but I have been unsuccessful so far. The branch is being created via the Supabase github integration when I open a PR, but the environment variables never get updated. The documentation claims
As branching integration is tied to the Preview Deployments feature in Vercel, there are possible race conditions between Supabase setting correct variables, and Vercel running a deployment process. Because of that, Supabase is always automatically re-deploying the most recent deployment of the given pull request. (https://supabase.com/docs/guides/deployment/branching/integrations)
but I have never seen such a redeploy, and my Vercel builds always have the main branch environment variables. Some additional info: my Supabase organization is managed by Vercel marketplace, and was set up through Vercel.
Integrations | Supabase Docs
Use Supabase branching with hosting providers and other tools.
No description
5 Replies
Kirill
Kirillβ€’5w ago
Did you resolve this? Just curios whether its worth migrating to vercel marketplace or stick with direct supabase
Ph
Phβ€’4w ago
@Polyglot @Kirill Hi guys, I'm having the exact same issue. Apparently this can be solved if the env variables added by Supabase integration in Vercel's project settings are scoped only to prod (not preview), that way supabase integration will inject the env variables in the app preview build, but if a env varaible with same name and environment scope is set it will skip the injection, and that's why it's not working, I guess. The solution would be to just simply leave the supabase env variable in vercel project setting only for prod but I couldn't find a way to edit the env variables there nor from supabase dashboard.
Kirill
Kirillβ€’4w ago
THanks @Ph, the variables are locked in vercel automatically, I suppose the only way is to re-add them manually πŸ™
Ph
Phβ€’4w ago
@Kirill But you cannot re add them manually, I was able to re add them from supabase only for production hoping that the preview deployment will inject the supabase branch variables, but it seems adding the variables only for prod makes supabase to skip preview altogether. In the end I just raised a ticket to support desk. Let’s see what they say πŸ™‚
Kirill
Kirillβ€’4w ago
@Ph yeah I just migrated, hope it wasn't a mistake.. will report back. Let me know what support says. Do you have a ticket URL?

Did you find this page helpful?