Title: Preserving deployment-specific secrets when deploying updated files via Vercel API
Hello Vercel Community!
Vercel Support directed me here because my team is on the Hobby plan.
I need technical guidance on updating four source files while preserving the exact environment variables and secrets from an existing protected Preview deployment.
Environment:
- Project:
luremi-rewards-staging - Original deployment:
dpl_YuHxrJuEYwNThf3kuTW7Zzzncftt(READY) - Failed deployment:
dpl_47TCkYhHXzZBBePrJ31NR7R3bgRo - Vercel CLI:
65.16.0 - Original deployment created through CLI, without Git integration.
The original deployment contains deployment-specific build-time and runtime variables, including an HMAC secret used for signing QR codes.
I must preserve this exact secret because rotating it could invalidate previously issued QR codes.
I attempted a new deployment using deploymentId and updated files. The build failed with REWARDS_PREVIEW_SUPABASE_MISMATCH. My local diagnostics suggest that required deployment-specific environment variables were not preserved.
The Vercel AI support agent explained that redeploying with deploymentId can inherit the original configuration, but could not confirm whether supplying replacement files is supported while preserving those variables.
My questions:
- Does the Vercel Deployments API support combining
deploymentIdwith replacementfileswhile inheriting all original deployment-specific environment variables? - Is there an officially supported alternative to rebuild updated code using exactly the same HMAC secret, without retrieving or rotating it?
- How can we guarantee that build-time and runtime variables are both preserved?
- How can we prevent general Preview environment variables from overriding or replacing the deployment-specific values?
Important: I am requesting technical guidance only. Please do not initiate deployments, modify environment variables, rotate secrets, or reassign aliases.
The existing Preview remains protected and operational. I have not modified production.
Thank you for your help!