Nework failed issue during post method

This issue has been created since 2022-09-22.

Description

here i'm trying to upload data with image from android app to code igniter server but its shows an error every time

Version

0.66.0

Output of npx react-native info

System:
OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
CPU: (4) x64 Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz
Memory: 2.13 GB / 7.66 GB
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 12.22.9 - /usr/bin/node
Yarn: Not Found
npm: 8.5.1 - /usr/bin/npm
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: 11.0.16 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.0 => 0.66.0
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

const formData = new FormData();

formData.append('u_id', u_id);
// formData.append('image', {
//   uri: get_data.Step_1_data[0].image.uri,
//   type: get_data.Step_1_data[0].image.type,
//   name: get_data.Step_1_data[0].image.fileName,
// });
formData.append('cat_id', get_data.Step_1_data[0].category.value);
formData.append('title', get_data.Step_1_data[0].category.value);
formData.append('discription', get_data.Step_1_data[0].description);
formData.append('publish_date', get_data.Step_1_data[0].publish_Date);
formData.append('expairy_date', get_data.Step_1_data[0].expire_date);
formData.append(
  'department_id',
  get_data_2.Step_2_data[0].Departement_id.value,
);
formData.append('cource_id', get_data_2.Step_2_data[0].Course_id.value);
formData.append('delivery_type', 1);
console.log(formData);
await fetch(BaseUrl + 'st_create_notice', {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'content-type': 'multipart/form-data',
  },
  body: formData,
})
  .then(Response => Response.json())
  .then(async data => {
    if (data.error_code == 200) {
      // return JSON.stringify(data);
    } else {
      console.log('abc');
      console.log(data);
    }
  });

whats wrong here i also try to send without image

Snack, code example, screenshot, or link to a repository

Screenshot from 2022-09-22 19-28-11

pablolucas890 wrote this answer on 2022-09-22

Can u try with axios?

Recentrly i hava same problem with the natural node fetch so, before a litle bit work, i'm use the axios post and the code working

rahulnainwal107 wrote this answer on 2022-09-27

There is issue with fetch in react-native. You can check this issue #28551.

Akintunji wrote this answer on 2022-10-01

Please I'm having the same issue too
"Unhandled promise rejection:TypeError: Network request failed". Please any solution to this

Akintunji wrote this answer on 2022-10-01
More Details About Repo
Owner Name facebook
Repo Name react-native
Full Name facebook/react-native
Language JavaScript
Created Date 2015-01-09
Updated Date 2022-10-07
Star Count 105180
Watcher Count 3671
Fork Count 22481
Issue Count 2230

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
assert 'nc' in data, "Dataset 'nc' key missing." 3 2022-09-10 2022-10-06
Open VSX Listing: Signing the Publisher Agreement 1 2021-01-05 2022-08-29
Dúvidas básicas sobre a API PIX e integração com ERP 9 2022-01-06 2022-09-27
Sila - Error code INVALID_FIELD and ERROR Message Android package name must be configured in the developer dashboard. 3 2021-02-08 2022-07-21
Icon request: tokopedia 1 2022-01-14 2022-03-22
Feature request: support `--archives` 2 2020-06-13 2022-10-06
Qt versions besides 5 3 2020-07-16 2022-09-25
[Layout] Layout Header 有内置的 title, subtitle, 回退按钮样式么 7 2022-07-25 2022-09-17
[PORTER]gcr.io/knative-releases/knative-kafka-broker-receiver:v1.6.7 2 2022-09-23 2022-09-26
Icon ios doesn't work 0 2021-12-02 2022-09-17
[Feature] Add --all switch to "scoop cleanup" subcommand. 4 2022-04-25 2022-10-06
Remove "sample" format and its asteval dependency 0 2022-03-19 2022-10-04
Does not (visibly) start 9 2021-06-22 2022-08-17
[MU4 Issue] Note input still "enabled" in publish 1 2022-04-10 2022-09-15
Tune DCS context list descriptions 1 2021-04-27 2022-09-29
[SEC] SSH into AWS EKS K8s pod without Public IP 1 2021-11-05 2022-08-08
support for const fields of Julia 1.8? 1 2022-07-21 2022-09-26
no result from gallery when try it on iphone 8 0 2022-08-25 2022-10-03
Crop multiple selected image 0 2022-09-08 2022-10-03
getBusinessEmail don't work 3 2021-02-02 2022-10-04
Fix `VisibilitySimulator` Tutorial 1 2021-07-20 2022-09-21
Recast Navigation: Changing Uniform Scale value of entity with White Box collider does not update NavMesh 1 2022-07-13 2022-08-31
VLESS 的目的是不是跑偏了,不是为了TLS协议吗,现在xtls有什么作用? 7 2020-10-02 2022-09-28
error while loading shared libraries: ?: cannot open shared object file: No such file or directory 3 2021-09-28 2022-09-13
innerDrawerCallback parameter -> which side 3 2020-12-05 2022-10-06
GoWebDav 未运行,这个软件运行不了 1 2022-06-05 2022-07-21
[question] How is better to create the recipe for Rust library with C bindings? 0 2022-01-16 2022-09-20
Access a localhost:1234 resource from inside a DDEV container 7 2022-03-01 2022-03-26
[Bug]: in "apt list" output, random duplicate "stable" 4 2022-07-05 2022-09-28
Add support for thermocouples for Recore in Klipper 1 2021-11-20 2021-12-31
Recurring Dates 0 2021-11-29 2022-01-07
Update IDEAS.md 0 2019-11-11 2022-01-20
比vpn都好用,太好用了 👍👍👏👏 0 2021-06-22 2022-01-16
Can we have the actual output of test set? 0 2019-06-24 2022-09-20
ReferenceError in /docs/tracks/x86-64-assembly/tests 0 2022-08-05 2022-08-23
ReferenceError in /tracks/python/exercises/making-the-grade/solutions/Zardian 0 2022-08-08 2022-08-23
Missing way to show uploaded files 1 2019-12-08 2022-08-17
Getting 'unexpected EOF' error frequently while reading r.Body() 0 2021-08-27 2022-10-02
PEP 801: Add reasons for being reserved? 1 2022-07-01 2022-10-03
analyzing people in video: should identify people in a file in Google Storage failed 2 2022-07-16 2022-09-24
Add a new pipeline for IAM role prefix testing 0 2021-09-15 2022-09-19
`juju export-bundle` fails on microk8s `nginx-ingress-integrator` operator 0 2021-05-07 2022-09-20
[CONTENT REQUEST] (add your title here!) 2 2022-04-27 2022-08-14
ScenePic visualizations do not display in VS Code 3 2022-09-13 2022-09-26
no currency symbols for Indian currency (₹) 3 2022-09-12 2022-09-26
QUESTION: Does this work with React-Native 2 2019-03-16 2022-09-22
Docs: Add an example of CTAS with PARTITIONED BY 7 2022-01-06 2022-08-01
Allow for appending tasks to co-exist with each other. 1 2021-12-08 2022-09-16
BelongsTo relations inside HasOne 1 2022-06-25 2022-08-29
Redis TagAwareCacheInterface stopped working after upgrade to 5.4.2 27 2022-01-09 2022-09-24