Deploying to Vercel - now errors with build and dev part 1
I've been developing a T3 app, using first MySQL in Docker and then Postgres in Docker without any problems or errors. But I finally got around to trying to deply to Vercel, something I should have been doing from the start but hey ho.
The setup seemed straightforward but, having followed the vercel setup instructions and imported the .env, .env.local and .env.development.local I now get errors when I run pnpm dev or pnpm build. Both complain that there are invalid environmental variables, NEXTAUTH_URL, even though that variable is there and it was working fine before the import of other variables. Might anyone know the cause of the problem please? Post split into two parts ==== this is the made safe for publishing version of my .env files DATABASE_URL="postgres://default:[email protected]/verceldb" DISCORD_CLIENT_ID="123456789” DISCORD_CLIENT_SECRET=“secretsecret" NEXTAUTH_SECRET=“XXXXXXXXXXXXXX” NEXTAUTH_URL="http://localhost:3000" NX_DAEMON="" POSTGRES_DATABASE="verceldb" POSTGRES_HOST=“servername.postgres.vercel-storage.com" POSTGRES_PASSWORD=“XXXXXXXX” POSTGRES_PRISMA_URL="postgres://default:[email protected]/verceldb?pgbouncer=true&connect_timeout=15" POSTGRES_URL="postgres://default:[email protected]/verceldb" POSTGRES_URL_NON_POOLING="postgres://default:[email protected]/verceldb" POSTGRES_USER="default"
The setup seemed straightforward but, having followed the vercel setup instructions and imported the .env, .env.local and .env.development.local I now get errors when I run pnpm dev or pnpm build. Both complain that there are invalid environmental variables, NEXTAUTH_URL, even though that variable is there and it was working fine before the import of other variables. Might anyone know the cause of the problem please? Post split into two parts ==== this is the made safe for publishing version of my .env files DATABASE_URL="postgres://default:[email protected]/verceldb" DISCORD_CLIENT_ID="123456789” DISCORD_CLIENT_SECRET=“secretsecret" NEXTAUTH_SECRET=“XXXXXXXXXXXXXX” NEXTAUTH_URL="http://localhost:3000" NX_DAEMON="" POSTGRES_DATABASE="verceldb" POSTGRES_HOST=“servername.postgres.vercel-storage.com" POSTGRES_PASSWORD=“XXXXXXXX” POSTGRES_PRISMA_URL="postgres://default:[email protected]/verceldb?pgbouncer=true&connect_timeout=15" POSTGRES_URL="postgres://default:[email protected]/verceldb" POSTGRES_URL_NON_POOLING="postgres://default:[email protected]/verceldb" POSTGRES_USER="default"
3 Replies
your .env file is local to your machine and is not uploaded to vercel. you can add the environment variables you need through your Vercel dashboard. it's under Settings -> environment variables
you can even upload your .env file directly
uh u mentioned "MySQL in docker, then Postgres in docker" do u mean to say ur running both MYSQL and Postgres locally? in which case Im pretty sure u cant do that on Vercel, vercel ONLY serves serverless functions, meaning data isnt persistent and u cant host a database locally on its servers
Which is y, vercel integrates with db providers like Neon to simplify hosting ur db