chen-rn / CUA

(deprecateed) create-universal-app(CUA) is an opinionated template for creating fullstack universal apps (Expo, Next, tRPC, Prisma, Clerk, Solito, Tamagui)

Home Page:https://cua-demo.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Network request failed` on mobile app

arcanistzed opened this issue · comments

I'm launching the app in Android Studio and the app opens and seems to work at first for a second, but then it switches to just showing Network request failed in the corner of the screen. The terminal says WARN [TRPCClientError: Network request failed]. No issues with the web version.
Any idea what the issue could be?

I'm not sure but it might be related to how the tRPC base URL for client is created.

Maybe try hard-coding it and see if that works for native.

commented

Yea it could be an url issue, is your Next app hosted on 3000?

I also ran into this. I didn't realize it at first but @chen-rn I think you're saying that having yarn web already running in another terminal and serving the API on localhost:3000 is a prerequisite to running yarn native?

After I get yarn web running separately, yarn native works as expected. I was thinking that somehow yarn native would also serve the APIs locally but it makes sense that it would be handled by the Next devserver. If it would help I could open a PR to try to make that more clear in the setup doc

commented
commented

I'll close this for now and have added a comment beside yarn native, but I do agree the doc will likely need an overhaul sometime soon and welcome any PRs!!