Skip to content

React Native errorReact Native: “TypeError: Network request failed”

fetch or axios in a React Native or Expo app fails with TypeError: Network request failed, with no status code and no response. The request never completed: the operating system blocked it, the device could not reach the address, or the TLS handshake failed. The same URL often works in the browser and in Postman, which is what makes this confusing.

Short answer

Check the URL first. If it starts with http://, iOS (App Transport Security) and Android 9 and later block it by default; use HTTPS, or add a narrow exception for your development host. If it says localhost, a phone or emulator cannot reach your computer that way: use your computer’s LAN IP, 10.0.2.2 on the Android emulator, or a tunnel. If it is HTTPS and still fails on Android, check that the server sends its full certificate chain. For uploads, do not set the multipart Content-Type header yourself.

Why the request never completed, and the fix

  1. 01

    An http:// URL blocked by the operating system

    “By default, iOS enforces App Transport Security (ATS), requiring any HTTP connection to use HTTPS.” React Native, Networking

    Both platforms block plain HTTP by default. Use HTTPS for anything real. For a development server, add an exception only for that host (on Android as below, on iOS an NSExceptionDomains entry in Info.plist), not for every domain.

    <!-- android/app/src/main/res/xml/network_security_config.xml -->
    <network-security-config>
      <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">192.168.1.20</domain>
      </domain-config>
    </network-security-config>
    
    <!-- AndroidManifest.xml, on the application tag -->
    <application android:networkSecurityConfig="@xml/network_security_config">
  2. 02

    localhost on a phone or emulator

    On a device, localhost is the device itself. The Android emulator reaches your computer at 10.0.2.2; a real phone needs your computer’s LAN IP on the same Wi-Fi, or a tunnel. The iOS simulator shares your Mac’s network, so localhost works there.

    const API_URL = __DEV__ ? 'http://192.168.1.20:3000' : 'https://api.example.com';
  3. 03

    Android 9 and later block cleartext too

    “On Android, as of API Level 28, clear text traffic is also blocked by default.” React Native, Networking

    An app that works on iOS with an ATS exception can still fail on Android, which needs its own opt-in through a network security config or usesCleartextTraffic. In Expo, set android.usesCleartextTraffic with the expo-build-properties plugin in a development or production build (not Expo Go) rather than editing native files.

  4. 04

    HTTPS that fails on Android, or a broken upload

    Android rejects servers that do not send their intermediate certificate, even when browsers accept them; fix the chain on the server. For file uploads with FormData, leave Content-Type unset so the boundary is added for you.

    const body = new FormData();
    body.append('file', { uri, name: 'photo.jpg', type: 'image/jpeg' });
    await fetch(url, { method: 'POST', body }); // no Content-Type header

Checked against the vendor’s docs on : React Native: Networking; Android: Network security configuration.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Axios “Network Error” · JavaScript “TypeError: Failed to fetch” · Firebase Auth “network-request-failed” · React Native text strings must be rendered within <Text>

Questions

More on this error

It works in debug but fails in the release build. Why?

On Android, the default React Native debug build allows cleartext HTTP and the release build does not, so an http:// API that worked in debug is blocked in release. On iOS, ATS blocks http:// to public hosts in both, apart from local network addresses. Move the API to HTTPS.

Should I set NSAllowsArbitraryLoads to true?

Not for production. It turns off App Transport Security for every domain, and App Store review asks you to justify it. Use HTTPS, or an exception for one domain.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.