FAQ & Troubleshooting

Answers to frequently asked questions and practical solutions to common networking challenges.


Frequently Asked Questions

Does react-native-fetch-client require any CocoaPods or Gradle setup?

The package does not ship a native networking module and uses the runtime Fetch implementation by default. The React Native or Expo runtime still needs to provide the Fetch APIs required by your app.

How does the single-flight 401 refresh token mutex work?

When auth.refreshToken is configured, concurrent eligible responses share a single refresh operation. After it resolves, requests retry with a token from getToken. Configure refreshExcludeUrls for the refresh endpoint to avoid trying to refresh that URL recursively.

How does it handle partial cancellation with in-flight deduplication?

If Component A and Component B share an in-flight request and Component A cancels its AbortSignal, the client checks if other listeners remain. If Component B is still waiting, the underlying network flight is preserved, ensuring Component B completes successfully.

Can I use this in Node.js or browser web applications?

The package metadata declares Node.js 18 or newer. In browsers and other runtimes, use an environment with a compatible Fetch implementation, or provide fetchImpl.

What is durationMs on the response object?

HttpResponse.durationMs is optional. When present, it is an elapsed duration in milliseconds; the implementation uses Date.now() timing.

Common Troubleshooting Scenarios

Network request failed

If an HTTP request fails in a platform runtime, check its network security settings, permissions, and error details. Prefer HTTPS for production APIs.

401 loop on token refresh

Use auth.refreshExcludeUrls to exclude the refresh endpoint from refresh handling. If the refreshToken callback throws, the original request rejects with that failure; the package does not export a dedicated AuthRefreshError class.