vercel-azure-devops-extension icon indicating copy to clipboard operation
vercel-azure-devops-extension copied to clipboard

environment variables are not respected

Open svscorp opened this issue 9 months ago • 2 comments

Hi all,

I'm troubleshooting why my environment variables specified in the build-env are not picked up by the application.

Using this pipeline code

        - task: vercel-deployment-task@1
          displayName: Deploy
          inputs:
            vercelToken: $(VERCEL_TOKEN)
            vercelOrgId: $(VERCEL_ORG_ID)
            production: true
            debug: true
            buildEnv: 'KEY1=VAL1 --build-env KEY2=VAL2'
            vercelCwd: 'client'

In the logs, I see (Vercel CLI 41.1.1): /usr/local/bin/vercel deploy --prod --token=*** --cwd=client --build-env KEY1=VAL1 --build-env KEY2=VAL2. When I check further debug logs I can't see these variables in the"Deployment response": ..."build":{"env":["CI","VERCEL",.....

When I run via cli (Vercel CLI 41.1.0) from my shell vercel deploy --prod --token=*** --cwd=client --build-env KEY1=VAL1 --build-env KEY2=VAL2 the environment configuration is picked up by the application. Also, I can see these KEY1 and KEY2 variables in the further output of "Deployment response": ..."build":{"env":["CI","VERCEL","KEY1","KEY2",.....

Any thoughts?

UPDATE: Wrote manually in the pipeline: vercel link + vercel deploy with the same arguments, and it worked.

svscorp avatar Feb 13 '25 11:02 svscorp

Hey @svscorp, it's intended to be used with line breaks between the envs, e.g. like this:

        - task: vercel-deployment-task@1
          displayName: Deploy
          inputs:
            vercelToken: $(VERCEL_TOKEN)
            vercelOrgId: $(VERCEL_ORG_ID)
            production: true
            debug: true
            buildEnv: |
              KEY1=VAL1
              KEY2=VAL2
            vercelCwd: 'client'

phidol avatar Mar 28 '25 21:03 phidol

I see. This was not obvious :) Maybe it can be added to documentation, unless I am the only one struggled. If it's not needed - I can close the thread.

svscorp avatar May 02 '25 15:05 svscorp