Hi guys, I need help overriding the
Hi guys, I need help overriding the build command on eas.
On Vercel with a NextJS project, you can override it with this command
npx convex deploy --cmd 'npm run build'
How do I achieve this in eas build command with a convex react native project?
11 Replies
Are you triggering eas builds from CI?
Or just running them manually as needed
I'm running manually. I just run eas build on terminal, download and upload to the stores
That's what I do as well. My process is to deploy convex with every merge to main, separate from the eas builds.
I also do all of my eas builds locally (way faster and free), but the process is the same either way
Can you please give me a walkthrough? I really don't understand completely
When you merge new convex code to main, run
npx convex deploy
to deploy to production, no --cmd
flag used
You'll have people using old and new versions of your app simultaneously, so the backend has to be non-breaking for multiple versions anyway
So, consider you have a single backend that stays fresh and has to serve your new eas build as well as potentially older builds for users that haven't updated. Because of this, deploying convex to prod and building with eas don't really need to happen in sync - it's actually better imo to treat them as 100% not in sync, because they can't be anyway.
Let me know if that makes sense
Or I can go into more detail on any specific parts or questionsYes, its makes sense but my app structure doesn't really fit into what you do.
I don't merge new convex code to code, I just have my dev and production channels on convex. I don't even run npx convex deploy because my code gets deployed automatically whenever I run npx convex dev.
The only thing I do literally is to run two terminals, one for convex and the other for expo cli. Everything works well while on expo go... The problem comes in when I create a preview build or I'm pushing to the stores. During my last push to the store, I go a report which I will attach the screenshot now.
From all you're saying its either my architecture is wrong or I need to alter the whole build process.
Your preview and store builds are running on your convex production instance, correct?
ah reading your error
Guessing you're passing your convex url to
ConvexReactClient
using an environment variable, and that variable is undefined in EAS
Is your app both expo and web or is this just an expo project
Eg., do you have a web app on vercel or something that is also using your convex backend, or is it just the expo projectIts just an expo project
I'm actually previewing with my convex dev instance. I want to check it out first before I switch over to the production instance.
The only reason I'm mentioning web is because I have built convex applications with web and they all worked well. This is like my first mobile project with convex and I'm trying to replicate same processes at least.
Gotcha - whether you use dev or production instance, you have to set whatever environment variable your client is expecting to have the convex url in EAS, sounds like it's currently undefined
I believe that's all you'll need to do for your immediate goal
you can figure out which env var you're using by looking at your root component, you should have something like:
Hi @erquhart
After much trials and errors, I think I finally found the issue with my app.
Its had nothing to do with convex, I got a different error. Its my svg components that keeps breaking the app. I finally ran my app with development build and discovered it. So I'm currently trying to work on it and fix it. Thank you so much for your help and guidiance. I will keep you posted.
Glad you got some traction!