Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to make requests to local API from iOS #480

Open
domnantas opened this issue Feb 4, 2025 · 0 comments
Open

Unable to make requests to local API from iOS #480

domnantas opened this issue Feb 4, 2025 · 0 comments

Comments

@domnantas
Copy link

domnantas commented Feb 4, 2025

Current Behavior

Making requests to local API on iOS causes TypeError: Network request failed error in some cases:

  • Web – works as expected
    • Relative URL (/api/hello) ✅
    • localhost URL (http://localhost:8081/api/hello) ✅
    • Local IP URL (http://192.168.0.[x]:8081/api/hello) ✅
  • iOS simulator
    • Relative URL (/api/hello) ❌ – Network request failed
    • localhost URL (http://localhost:8081/api/hello) ✅
    • Local IP URL (http://192.168.0.[x]:8081/api/hello) ✅
  • Real iOS device
    • Relative URL (/api/hello) ❌ – Network request failed
    • localhost URL (http://localhost:8081/api/hello) ❌ – Network request failed
    • Local IP URL (http://192.168.0.[x]:8081/api/hello) ✅

This makes testing on mobile difficult, especially with createBetterAuthClient({ baseURL }) where baseURL needs to be set to local IP for convenient development.

Expected Behavior

Fetching should work consistently across devices, or this issue should be mentioned in the documentation.

I understand this is not one-specific issue, but perhaps we could tweak Expo/React Native settings on the example templates to make the development experience smoother.

One Version

1.1.432

Platform (Web, iOS, Android)

iOS, might be reproducible on Android too.

Reproduction

https://github.com/domnantas/one/tree/ios-api-issue

System Info

System:
    OS: macOS 15.0.1
    CPU: (8) arm64 Apple M1
    Memory: 73.61 MB / 16.00 GB
    Shell: 3.6.1 - /usr/local/bin/fish
  Binaries:
    Node: 20.12.2 - ~/.volta/tools/image/node/20.12.2/bin/node
    Yarn: 4.5.3 - ~/.volta/tools/image/yarn/4.6.0/bin/yarn
    npm: 10.5.0 - ~/.volta/tools/image/node/20.12.2/bin/npm
    bun: 1.1.7 - /opt/homebrew/bin/bun
  Browsers:
    Safari: 18.0.1
  npmPackages:
    @react-native-community/cli: 15.1.3 => 15.1.3 
    @types/react: ^18.3.11 => 18.3.18 
    expo: ~52.0.17 => 52.0.30 
    one: 1.1.432 => 1.1.432 
    react: ^19.0.0 => 19.0.0 
    react-native: ^0.76.5 => 0.76.6 
    react-native-reanimated: ~3.16.5 => 3.16.7 
    react-native-safe-area-context: 4.10.5 => 4.10.5 
    react-native-screens: 4.4.0 => 4.4.0 
    react-native-web: ^0.19.12 => 0.19.13 
    vite: ^6.0.6 => 6.0.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant