I've followed this guide to deploy any commit to my new custom env test.
Here is my workflow:
name: Vercel Test Deploymenton:push:branches-ignore:- mainjobs:Deploy-Test:runs-on: ubuntu-latestenvironment: Previewenv:VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}STRIPE_WEBHOOK_SECRET: ${{ secrets.STRIPE_WEBHOOK_SECRET }}NEXT_TELEMETRY_DISABLED: 1ENABLE_EXPERIMENTAL_COREPACK: 1NODE_OPTIONS: '--max-old-space-size=8192'REDIS_URL: ${{ secrets.REDIS_URL }}SKIP_POSTBUILD: truesteps:- uses: actions/checkout@v2- name: Install Vercel CLIrun: npm install --global vercel@latest- name: Pull Vercel Environment Informationrun: vercel pull --yes --token=${{ secrets.VERCEL_TOKEN }}- name: Build Project Artifactsrun: vercel build --environment=test --token=${{ secrets.VERCEL_TOKEN }}- name: Deploy Project Artifacts to Vercelrun: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}Running this workflow, I get a build error:
Generating static pages (0/38) ...
md-link-1TypeError: Invalid URL
md-link-2at t.default (.next/server/chunks/5375.js:3:24386)
md-link-3at 34790 (.next/server/chunks/5375.js:3:107104)
md-link-4at t (.next/server/webpack-runtime.js:1:128)
md-link-5at 8364 (.next/server/chunks/3528.js:1:1178)
md-link-6at t (.next/server/webpack-runtime.js:1:128)
md-link-7at 44740 (.next/server/chunks/3528.js:1:12062)
md-link-8at Object.t [as require] (.next/server/webpack-runtime.js:1:128) {
md-link-9code: 'ERR_INVALID_URL',
md-link-10input: ''
md-link-11}
md-link-12Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
md-link-13TypeError: Invalid URL
md-link-14at new URL (node:internal/url:806:29)
md-link-15at t.default (/home/runner/work/haven-app/haven-app/.next/server/chunks/5375.js:3:24386)
md-link-16at 34790 (/home/runner/work/haven-app/haven-app/.next/server/chunks/5375.js:3:107104)
md-link-17at t (/home/runner/work/haven-app/haven-app/.next/server/webpack-runtime.js:1:128)
md-link-18at 8364 (/home/runner/work/haven-app/haven-app/.next/server/chunks/3528.js:1:1178)
md-link-19at t (/home/runner/work/haven-app/haven-app/.next/server/webpack-runtime.js:1:128)
md-link-20at 44740 (/home/runner/work/haven-app/haven-app/.next/server/chunks/3528.js:1:12062)
md-link-21at Object.t [as require] (/home/runner/work/haven-app/haven-app/.next/server/webpack-runtime.js:1:128)
md-link-22at require (/home/runner/work/haven-app/haven-app/node_modules/.pnpm/next@15.3.0_@babel+core@7.27.1_@opentelemetry+api@1.9.0_@playwright+test@1.52.0_react-d_dd4646987bfb2246c23c65d1b77cd876/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:140:10304)
md-link-23at u (/home/runner/work/haven-app/haven-app/node_modules/.pnpm/next@15.3.0_@babel+core@7.27.1_@opentelemetry+api@1.9.0_@playwright+test@1.52.0_react-d_dd4646987bfb2246c23c65d1b77cd876/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:92:646)
md-link-24Export encountered an error on /_not-found/page: /_not-found, exiting the build.
md-link-25⨯ Next.js build worker exited with code: 1 and signal: null
md-link-26 ELIFECYCLE Command failed with exit code 1.
md-link-27Error: Command "pnpm run build" exited with 1
md-link-28Error: Process completed with exit code 1.Locally build works fine, and even more strangely, If I set the deployment workflow destination to 'preview' env (and not my custom env) everything works just fine!! (
)
Any idea what can fix it?