React Native Deployment
Please I need help to deploy for react native. I have tried so many maneouvers but the app just can't get the CONVEX_URL.
I'm using expo for development and using eas build for deployment. The best result I go recently when I tried pushing to google store is in the screenshot attached.
I have updated my environment vairables on eas and still nothing.
9 Replies
What does the code setting up for the
ConvexReacClient
look like?
And what does the build command look like here? (we should probably add a guide on using EAS)
I think for expo, we usually have the URL stored in EXPO_PUBLIC_CONVEX_URL
and npx convex deploy
should handle setting it for you in the build stepThank you so much for your response. I was scared I wouldn't get any.
So yeah, For the ConvexReactClient, this is how I initialize it
So, in my app/_layout.tsx file,
function RootLayoutNav() {
const convex = new ConvexReactClient(process.env.EXPO_PUBLIC_CONVEX_URL!, {
unsavedChangesWarning: false,
});
return (
<ConvexProvider client={convex}>
<Slot />
</ConvexProvider>
);
}
From the build error, its saying EXPO_PUBLIC_CONVEX_URL is probably undefined. From this line here "Exception com.facebook.react.common.JavascriptException: Error: No address provided to ConvexReactClient." Although I already added it to my env both on eas and the codebase.
Also when I monitor the logs, it shows the environment variables properly too.
I honestly don't know what the build command look like.
Now you mention it, I just remember that while deploying NextJS projects, You have to override the build command to run the npx convex deploy process and which I didn't.
But on NextJS, its easy because of the guide given by your team on the docs. But nothing has been said about expo.
Please it is high priority to have something like that for expo(EAS builds).
I'm really looking forward to that update.
Yeah, I think I need to add npx convex deploy in the build step. But I don't know how.
On the eas docs, I just looked up custom build configuration.
Heres the link: https://docs.expo.dev/custom-builds/get-started/
It involves writing a .yml file and I really don't know how that works. Although I will start looking it up but your help will really go a long way to help me figure this out.
Thank you @sshader
Expo Documentation
Get started with custom builds
Learn how to extend EAS Build with custom build workflows.
Ok trying some of this out myself -- I think perhaps we want to use EAS for just deploying the mobile app portion, but then need some wrapper (e.g. a Github action) that builds the mobile app and then also deploys your convex functions (via
npx convex deploy
)
But just to get something building -- I'm finding that if I set the EXPO_PUBIC_CONVEX_URL
in the .env
file (to my prod deployment) my build is succeedingYes it works very well on the expo go app. I face this issues when I try pushing to production or creating a preview build.
Try creating a preview build and thats where I'm having issues
What's your goal for the preview build? To see UI changes against your prod data (and your prod convex functions)? Or to both UI + server-side changes?
The former is easier -- you can set up your preview builds to use the prod
EXPO_PUBLIC_CONVEX_URL
and preview the UI changes at leastActually, the latter. I just want to test out my convex functions before pushing to the stores
Have you set
EXPO_PUBLIC_CONVEX_URL
in the EAS dashboard?Yes I did. And it worked now. It tried everything on a different app and it worked very well. The issues were from a different component within my app.