nicooo
nicooo12mo ago

netlify deploy not working

Getting this error
No description
6 Replies
Abhishek
Abhishek12mo ago
@nicooo check your env variables, and add them before running the build also could you copy paste the err here ,reading from screen shot is hard
nicooo
nicoooOP12mo ago
✖ "npm run build" failed 3:04:05 PM: ​ 3:04:05 PM: "build.command" failed
3:04:05 PM: ──────────────────────────────────────────────────────────────── 3:04:05 PM: ​ 3:04:05 PM: Error message 3:04:05 PM: Command failed with exit code 1: npx convex deploy --cmd "npm run build" 3:04:05 PM: ​ 3:04:05 PM: Error location 3:04:05 PM: In Build command from Netlify app: 3:04:05 PM: npx convex deploy --cmd "npm run build" 3:04:05 PM: ​ 3:04:05 PM: Resolved config 3:04:05 PM: Failed during stage "building site": Build script returned non-zero exit code: 2 3:04:05 PM: build: 3:04:05 PM: command: npx convex deploy --cmd "npm run build" 3:04:05 PM: commandOrigin: ui 3:04:05 PM: environment: 3:04:05 PM: - CONVEX_DEPLOY_KEY 3:04:05 PM: - REACT_APP_CONVEX_URL 3:04:05 PM: publish: /opt/build/repo/build 3:04:05 PM: publishOrigin: ui 3:04:05 PM: Build failed due to a user error: Build script returned non-zero exit code: 2 3:04:05 PM: Failing build: Failed to build site the env variable for convex url should be the prod url right? because the convex deploy key is prod key..
Abhishek
Abhishek12mo ago
yes
Abhishek
Abhishek12mo ago
Also, try reading again ,the docs again maybe you have left some pointers : https://docs.convex.dev/production/hosting/netlify
Using Convex with Netlify | Convex Developer Hub
Host your frontend on Netlify and your backend on Convex.
nicooo
nicoooOP12mo ago
not on netlify though, but it worked on vercel.
erquhart
erquhart12mo ago
The error you pasted doesn't include the flag for renaming the env var, but the env var name isn't standard, so I'd expect this to fail Should be
npx convex deploy --cmd "npm run build" --cmd-url-env-var-
name REACT_APP_CONVEX_URL
npx convex deploy --cmd "npm run build" --cmd-url-env-var-
name REACT_APP_CONVEX_URL

Did you find this page helpful?