Next.js Discord

Discord Forum

secured environment variables in bitbucket pipelines

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
I used https://vercel.com/guides/using-vercel-cli-for-custom-workflows to build a CI/CD flow for bitbucket. My project has sensitive environment variables enforced. I get empty values when I use vercel pull for any environment during CI/CD. Is this by design? Do I need to recreate my ENV vars in the pipeline and write them to the pulled file manually?

6 Replies

i believe vercel pull brings in the dev variables (not prod or preview)
Barbary LionOP
I am using it with the --environment=preview
tbh, I have tried so many things, currently just vercel build --yes --environment=preview
but the env vars are empty when functions run
This is what my pipeline looks like atm:
image: node:20-alpine

pipelines:
  custom:
    preview:
      - step:
          deployment: staging
          name: 'Deploy to staging'
          script:
          # chromatic uses git in their build step.
          - apk update && apk add openssh && apk add git && apk add curl
          - git submodule update --init
          # get vercel cli
          - npm install --global vercel
          # build locally
          - vercel build --yes --token=$VERCEL_TOKEN
          # push to vercel
          - DEPLOYMENT_URL=$(vercel deploy --prebuilt --token=$VERCEL_TOKEN)
          # comment on the task
          - ./scripts/comment_on_jira_task.sh "$BITBUCKET_BRANCH" "$DEPLOYMENT_URL" "$DRIES_JIRA_USER_ID" "$JIRA_TOKEN_BASIC"
oh interesting then... sorry idk anything else