maros.studenic
maros.studenic3mo ago

deploy turbo project - nextjs, react native, convex on vercel

how to deploy this repo to vercel ? https://github.com/get-convex/turbo-expo-nextjs-clerk-convex-monorepo eg. how to structure builld command ? currently I have this in turbo.json
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": [
"**/.env.*local",
".env"
],
"ui": "tui",
"tasks": {
"build": {
"cache": false,
"outputs": [
"dist/**",
".next/**",
"!.next/cache/**"
],
"dependsOn": [
"^build"
]
},
"dev": {
"cache": false,
"persistent": true
},
"lint": {},
"clean": {
"cache": false
},
"deploy": {
"cache": false,
"dependsOn": [
"^build"
]
}
}
}
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": [
"**/.env.*local",
".env"
],
"ui": "tui",
"tasks": {
"build": {
"cache": false,
"outputs": [
"dist/**",
".next/**",
"!.next/cache/**"
],
"dependsOn": [
"^build"
]
},
"dev": {
"cache": false,
"persistent": true
},
"lint": {},
"clean": {
"cache": false
},
"deploy": {
"cache": false,
"dependsOn": [
"^build"
]
}
}
}
and this in packages/backend/package.json
{
"name": "@packages/backend",
"version": "1.0.0",
"description": "",
"scripts": {
"dev": "convex dev",
"setup": "convex dev --until-success",
"deploy": "npx convex deploy"
},
"author": "",
"license": "ISC",
"dependencies": {
"@clerk/clerk-sdk-node": "^5.0.15",
"convex": "^1.13.0",
"stripe": "^16.2.0",
"svix": "^1.25.0"
}
}
{
"name": "@packages/backend",
"version": "1.0.0",
"description": "",
"scripts": {
"dev": "convex dev",
"setup": "convex dev --until-success",
"deploy": "npx convex deploy"
},
"author": "",
"license": "ISC",
"dependencies": {
"@clerk/clerk-sdk-node": "^5.0.15",
"convex": "^1.13.0",
"stripe": "^16.2.0",
"svix": "^1.25.0"
}
}
But I dont know what to put in vercel command for build
GitHub
GitHub - get-convex/turbo-expo-nextjs-clerk-convex-monorepo: Monore...
Monorepo template with Turborepo, Next.js, Expo, Clerk, Convex - get-convex/turbo-expo-nextjs-clerk-convex-monorepo
12 Replies
Convex Bot
Convex Bot3mo 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!
ballingt
ballingt3mo ago
What have you tried, what are you worried about?
eg. how to structure builld command ?
Does this not work as is? What error do you see?
maros.studenic
maros.studenicOP3mo ago
I got stuck on this I mean yeah it is preview deployment in vercel
Detected a non-production build environment and "CONVEX_DEPLOY_KEY" for a production Convex deployment.
This is probably unintentional.
Detected a non-production build environment and "CONVEX_DEPLOY_KEY" for a production Convex deployment.
This is probably unintentional.
But i created separated project in convex, so I can have one permanent db for testing env and one permanent for production. So it would be nice if I can bypass this error and publish it, so i can see changes in my testing db. Is there any pypass for this ? I use this command in build "npx convex deploy --cmd 'turbo run build'"
ballingt
ballingt3mo ago
OK sounds like this is more complicated than the normal setup, you'll need to do some things in a more custom way. So instead of the normal setup of one development deploy per developer and preview deploys for PRs, you'd like like to use a separate project in Convex for test and prod. When you deploy you'll have to specify which one of these you want to deploy to. This is normally taken care of automatically but you'll need to do some customization. What do you want to happen when you deploy? You'll want to read the docs on this https://docs.convex.dev/production and https://docs.convex.dev/production/hosting/vercel To get help on this you might need to write out what you're trying to do and where the scripts described in those docs aren't working for you There is a bypass for this but using it is usually a mistake, so I'd want to understand what you're trying to accomplish first
maros.studenic
maros.studenicOP3mo ago
My setup is I have two convex projects - One production Second Staging I am using production for production in vercel And staging in preview in vercel That lets me test the functionality before I merge it to master. I know that there is a preview db, that i can create, but that would be temporary and I didnt wanted to prefill it each time. And project is monorepo with web and react native, and is using convex as the package. It uses turbo.
ballingt
ballingt3mo ago
Makes sense, so you probably want different build commands for preview and prod in Vercel right?
maros.studenic
maros.studenicOP3mo ago
Command can be same, because I have different CONVEX_DEPLOY_KEY in environments so I assume, that it could work with same build command. But I cant figure out the build command for it that builds nextsj and deploys convex. I tried different variations turbo build && cd packages/backend && npx convex build, but then the deploy of nextjs fails, because its probably in. different folder. And also found bypass but it generates this error In order to push, add convex to your package.json dependencies. Error: Command "npx convex deploy --check-build-environment disable --cmd 'turbo run build'" exited with 1 So I am assuming I am starting it in wrong folder Did you came across with some use case like this ?
ballingt
ballingt3mo ago
I understand your use case @maros.studenic but not the description of the issues you have I don't know how to solve your directory issues sounds like you're on the right track --cmd can be multiple statements I think so you can cd in there or run a script that you write, and that script can cd
maros.studenic
maros.studenicOP3mo ago
It just build and passed pipeline Solution was set root for app as apps/web and then
turbo run build && cd ../../packages/backend && npx convex deploy --check-build-environment disable
turbo run build && cd ../../packages/backend && npx convex deploy --check-build-environment disable
ballingt
ballingt3mo ago
wrong folder sounds like a good guess, try pwd to find out where you are nice!
maros.studenic
maros.studenicOP3mo ago
I think it can be in readme for that repo that I send at start. Its demo repo, but has no info about how to set up the vercel deploy for web. Thanks for your time Tom.
ballingt
ballingt3mo ago
Makes sense, feel free to open an issue or PR! I'll take note too.

Did you find this page helpful?