Upload file "Network request failed" with FormData in 0.85.0
Open
Nobody has claimed this yet.
Resolution: PR Submitted
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Description
Hello, I currently do this in version 0.85.0 and I get the error Network request failed.
The image are
{
name: 'IMG-20251203-WA0008.jpg',
type: 'image/jpeg',
uri: 'content://...' or 'file://...
}
const formData = new FormData();
formData.append('content', data.content);
data.images.forEach((e, i) => formData.append('images', e));
const response = await fetch('url', {
method: 'POST',
body: formData,
});
Steps to reproduce
const formData = new FormData();
formData.append('content', data.content);
data.images.forEach((e, i) => formData.append('images', e));
const response = await fetch('url', {
method: 'POST',
body: formData,
});
React Native Version
0.85.0
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: Linux 6.12 Debian GNU/Linux 13 (trixie) 13 (trixie)
CPU: (4) x64 Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
Memory: 2.34 GB / 7.63 GB
Shell:
version: 5.2.37
path: /bin/bash
Binaries:
Node:
version: 24.12.0
path: /usr/local/bin/node
Yarn: Not Found
npm:
version: 11.11.1
path: /usr/local/bin/npm
Watchman: Not Found
SDKs:
Android SDK:
API Levels:
- "34"
- "35"
- "36"
Build Tools:
- 33.0.0
- 34.0.0
- 35.0.0
- 36.0.0
Android NDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.17
path: /usr/bin/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 20.1.3
wanted: 20.1.3
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.85.0
wanted: 0.85.0
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
TypeError: Network request failed
at anonymous (fetch.umd.js:567:31)
MANDATORY Reproducer
https://github.com/AlexCernik/rn-formdata-reproducer
Screenshots and Videos
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the mandatory reproducer and inspecting the fetch call that posts FormData with image URIs on Android. Trace the React Native networking path used by that request and compare its behavior with the reported Network request failed error. Done means the reproducer can upload the images successfully on React Native 0.85.0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript, react-native
- Domain
- mobile, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100