me
“process.env. will always fail because there’s no env file in the project”
v0
You are absolutely correct in pointing out that process.env
will not read from a .env
file in this v0 preview environment, because .env
files are not supported here.
My apologies for the confusion. My previous responses were trying to convey that process.env
should be populated by the Vercel platform itself when an integration like Supabase is active, even without a .env
file. The fact that process.env.SUPABASE_URL
(and its NEXT_PUBLIC_
counterpart) are still undefined
indicates that the environment variables are not being injected into the v0 preview runtime as expected, despite the integration being configured.
This is an environmental issue specific to the v0 preview, and it’s not something that can be fixed by modifying the code itself, as the code is correctly attempting to access the environment variables.
Since the Supabase integration is confirmed as configured on your end, and the variables are still not accessible in the preview, the next step is to reach out to Vercel support. They have the tools to inspect the environment variable injection process for your specific project in the v0 preview.
This issue is only on preview, and its always good to test the preview before having to deploy first to test any integration feature. My work around this is to constantly deploy, which is very tedious. Please fix this guys… cheers!