entropy
entropy2w ago

Next build error when ran in github action

Hello, I'm trying to create a CI workflow for my nextjs website. The problem is that I keep getting a build error from convex when running my build step. I don't have this error when I run bun run build locally though.
Error: No address provided to ConvexReactClient.
If trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/
Error: No address provided to ConvexReactClient.
If trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/
5 Replies
Convex Bot
Convex Bot2w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
sshader
sshader2w ago
Do you want your github action to both deploy your convex functions to production + build and deploy your Next.js frontend? Or do you only want to do parts of this (like only build the frontend). If you're trying to deploy both convex + frontend, you'll want a deploy command like npx convex deploy --cmd 'npm run build' (I'm not familiar enough with bun to know the exact equivalents -- see https://docs.convex.dev/production/hosting/custom#custom-hosting). Usually build on its own just builds the frontend, and needs to be wrapped in npx convex deploy which handles setting the convex URL in an environment variable (NEXT_PUBLIC_CONVEX_URL is the default for next apps) + deploying your convex functions
Custom Domains & Hosting | Convex Developer Hub
Serve requests from any domains and host your frontend on any static hosting provider, such as GitHub.
entropy
entropyOP2w ago
I was trying to just build my frontend to make sure it can complete successfully as a part of my CI. For actually deploying to vercel I haven't had issues using the below build command. I assumed that maybe this issue was that the convex url was missing, but even when pulling my env vars from vercel before the build step in my CI it still throws the error above. cd ../../packages/backend && npx convex deploy --cmd 'cd ../../apps/web && turbo run build' --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL
sshader
sshader2w ago
what about setting NEXT_PUBLIC_CONVEX_URL explicitly in CI (just to rule out something fishy with pulling in env vars from elsewhere) I'm also kind of surprised that a build step would be hitting this error, since that looks like a runtime error. What does your build command look like? (Mine is just next build)
entropy
entropyOP2w ago
root package.json "build": "turbo build --parallel" next app package.json "build": "next build" turbo.json
"build": {
"env": ["CONVEX_DEPLOY_KEY", "CLERK_SECRET_KEY", "OPENPANEL_SECRET_KEY"],
"inputs": ["$TURBO_DEFAULT$", ".env"],
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", "next-env.d.ts", ".expo/**"]
}
"build": {
"env": ["CONVEX_DEPLOY_KEY", "CLERK_SECRET_KEY", "OPENPANEL_SECRET_KEY"],
"inputs": ["$TURBO_DEFAULT$", ".env"],
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", "next-env.d.ts", ".expo/**"]
}
Here's my action as well
name: Continuous Integration

on:
push:
branches:
- main

jobs:
build:
name: Lint, typecheck, and build
timeout-minutes: 15
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

steps:
- name: Check Out Code
uses: actions/checkout@v4

- name: Cache Turbo Build Setup
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-

- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.36

- name: Install Dependencies
run: bun install

- name: Check Linting
run: bun lint

- name: Check TypeScript Types
run: bun typecheck

- name: Build
run: bun run build
name: Continuous Integration

on:
push:
branches:
- main

jobs:
build:
name: Lint, typecheck, and build
timeout-minutes: 15
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

steps:
- name: Check Out Code
uses: actions/checkout@v4

- name: Cache Turbo Build Setup
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-

- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.36

- name: Install Dependencies
run: bun install

- name: Check Linting
run: bun lint

- name: Check TypeScript Types
run: bun typecheck

- name: Build
run: bun run build
this is without the testing I did with pulling env vars from vercel before building

Did you find this page helpful?