react-native icon indicating copy to clipboard operation
react-native copied to clipboard

'fetch' failed [version: 0.28.0-rc.0]

Open 12d opened this issue 10 years ago • 18 comments

Using 'fetch' to send request, it failed. Error message is 'Network request failed'. My code works well with '0.27'

12d avatar Jun 15 '16 05:06 12d

I'm using RN0.28 and it works fine, both POST and GET method, so perhaps u missed something

nihgwu avatar Jun 15 '16 06:06 nihgwu

Could you show me your code? I just run code from official site like this:

fetch('https://mywebsite.com/endpoint/', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    firstParam: 'yourValue',
    secondParam: 'yourOtherValue',
  })
})

My project was upgrade from "0.24''

12d avatar Jun 16 '16 04:06 12d

'Image' can not send request too, it runs into "onLoadEnd"

12d avatar Jun 16 '16 05:06 12d

'Image' can not display, here is my code: <Image source={{height:200,width:300,uri: 'http://facebook.github.io/origami/public/images/blog-hero.jpg'}}/>

12d avatar Jun 16 '16 06:06 12d

I have resolved it by adding 'Allow Arbitrary Loads' resolve

12d avatar Jun 16 '16 08:06 12d

I'll close this issue as it has been resolved with Allow Arbitrary Loads, if not feel free to let me know.

charpeni avatar Jun 17 '16 19:06 charpeni

@facebook-github-bot close

charpeni avatar Jun 17 '16 19:06 charpeni

@charpeni tells me to close this issue. If you think it should still be opened let us know why.

ghost avatar Jun 17 '16 19:06 ghost

This solution worked for me too. Shouldn't react-native init and react-native upgrade be updated to set this flag?

CaleyD avatar Jul 02 '16 03:07 CaleyD

I am getting this error while uploading video file using 0.27, I can upload a video up to-3-4 seconds, but when I try it something longer I get this error. Any idea?

cubbuk avatar Jul 21 '16 07:07 cubbuk

In case anyone is wondering where you add Allow Arbitrary Loads:

Props to @12d

screen shot 2016-07-21 at 8 07 44 pm

Go down to App Transport Security Settings > hit the + button > select Allow Arbitrary Loads > change the bool value to YES

artokun avatar Jul 22 '16 03:07 artokun

Keep in mind this might be a security risk for you and your users to allow non-secure connections... https://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/

cooperka avatar Apr 21 '17 19:04 cooperka

Still getting the issue with RN version 0.45

Jun 27 16:23:36 Administrators-Mac-mini Experiments[38809] : { [TypeError: Network request failed] line: 15459, column: 29, sourceURL: 'http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false' }

screen shot 2017-06-27 at 4 24 03 pm

proactive-solutions avatar Jun 27 '17 10:06 proactive-solutions

Still having this issue even after adding 'Allow Arbitrary Loads', exception domains. react-native: 0.50.4

hazeeb avatar Jan 24 '18 15:01 hazeeb

@hazeeb Have you solved the issue.

GopiKrishna10 avatar Jan 29 '18 06:01 GopiKrishna10

@GopiKrishna10 Not yet. :(

hazeeb avatar Jan 29 '18 09:01 hazeeb

Also having the issue, but only in debug build on iOS. That problem doesn't occur on a release build for me.

marco-krammer avatar Jan 30 '18 07:01 marco-krammer

Still having this issue, have followed all suggested steps.

ThomasAriano avatar Mar 06 '18 19:03 ThomasAriano