Problem: AdonisJS API not accessible from React Native (mobile device) even with LAN IP #5103
Replies: 1 comment
|
Once you've confirmed
CORS is unrelated to this specific symptom, it's a browser-enforced restriction on reading a cross-origin response, it doesn't prevent a TCP connection from being established in the first place, and it has no effect on a native React Native |
Uh oh!
There was an error while loading. Please reload this page.
Problem: AdonisJS API not accessible from React Native (mobile device) even with LAN IP
Hello AdonisJS team 👋,
I am currently trying to connect a React Native (Expo) mobile application to my AdonisJS backend, but I am facing an issue where the API is not accessible from external devices (mobile phone), even when using my local network IP.
Environment
Current configuration
.envAPI base URL used in React Native
Issue
When I try to access the API from my mobile device or even from another device on the same network, I get:
Network Errorin React NativeHowever, the API works perfectly on:
http://localhost:3333(on the same PC)What I already tried
HOST=0.0.0.0in.envipconfigStill, the server is not reachable externally.
Question
Is there something additional required in AdonisJS to expose the server to LAN devices (React Native / mobile testing)?
For example:
server.tsorapp.ts?Any guidance would be greatly appreciated 🙏
Thank you!
It's my first time using Adonis, it's nice!
All reactions