I'm facing the same issue, and it has worked with my previous deployment (26 days ago). My env variable is named FIREBASE_SERVICE_ACCOUNT_KEY and when adding echo $FIREBASE_SERVICE_ACCOUNT_KEY && in front of my build command, I can actually see its content in the build logs.
I tried deleting the environment variable and creating it again, but that didn't help. The variable is assigned to all environments. My current build command is pnpm turbo build --filter web, as I'm using turborepo and my Next.js app is located in apps/web, which I also configured as root directory in the project settings. I can reproduce this locally with the Vercel CLI by calling vercel build in my terminal. Adding the variable to my .env.local file fixes the issue locally. vercel dev works just fine, though, even without the .env.local "workaround".
Thanks for your help!