App works locally.
I’ve set up same env variables in my repository and variables wich are marked with _PUBLIC_
are visible in app.
But when I try for example to use email logic (which needs NEXT_RESEND_API
) server logs that I didn’t provide API_KEY
, so it doesn’t see it.
name: Jest tests
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on: push
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: yarn install
- name: jest tests
run: yarn test
- name: Install Vercel CLI
run: yarn global add vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
env:
NEXT_PUBLIC_MAPS_API: ${{ vars.NEXT_PUBLIC_MAPS_API }}
NEXT_PUBLIC_PAYPAL_CLIENT_ID: ${{ vars.NEXT_PUBLIC_PAYPAL_CLIENT_ID }}
NEXT_RESEND_API: ${{ vars.NEXT_RESEND_API }}
NEXT_PRIVATE_PAYPAL_KEY: ${{ vars.NEXT_PRIVATE_PAYPAL_KEY }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
How to set up variables which will be used on server side with GitHub Actions correctly? I don’t want to add them manually through Vercel interface.
I am using Next.js 14.2.
1