React-native: Error processing request body: Error Domain=NSCocoaErrorDomain Code=257

Created on 10 Nov 2017  Â·  16Comments  Â·  Source: facebook/react-native

Is this a bug report?

YES

Have you read the Contributing Guidelines?

YES

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.5.0
Yarn: Not Found
npm: 5.3.0
Watchman: 4.9.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: 0.48.4 => 0.48.4

Steps to Reproduce

  1. Take Images using ImagePicker Component
  2. Tried to upload the image i am getting this error
  3. it's not often but it will happen once out of 5 times.

Expected Behavior

  1. Able to capture image and system should be able to get the image from the specified url/path

Actual Behavior

Error processing request body: Error Domain=NSCocoaErrorDomain Code=257 "The file “InspireME” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/var/containers/Bundle/Application/E7F57FD7-965B-4C2D-9765-E445356CA8C7/InspireME.app, NSUnderlyingError=0x1c085dc70 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}

Reproducible Demo

  1. Take Images using ImagePicker Component
  2. Tried to upload the image i am getting this error
  3. it's not often but it will happen once out of 5 times.

img_82754333519b-1

Stale

Most helpful comment

Use image.path instead of image.sourceUri

All 16 comments

I am facing this issue too

I am uploading multi images to server, but if i don't chose enough image, this error will happen. Now, i am checking image in client, anyone have other solution?
screen shot 2017-11-20 at 10 52 54 am

i was trying to upload an empty image, when stopping that the error disappeared

+1

@AshokICreate did you find any solution for this issue

Check the local photo uri has the file:/// prefix. It shouldn't.

Use image.path instead of image.sourceUri

the problem was with my image.uri and form data

let formData = new FormData(); formData.append("videoFile", { name: name.mp4, uri: video.uri, type: 'video/mp4' }); formData.append("id", "1234567"); try { let response = await fetch(url, { method: 'post', headers: { 'Content-Type': 'multipart/form-data', }, body: formData }); return await response.json(); } catch (error) { console.log('error : ' + error); return error;

this code worked for me for iOS and android for uploading video

@LuisRizo image.sourceURL. For others running into this issue, confirm your source path/uri/url, it's likely pointed somewhere other than it should be.

@LuisRizo image.sourceURL works on iOS but not on android.
@bnauta what do you mean by it's likely pointed somewhere other than it should be on both iOS and Android.

Both thank you for helping this is already far better than not knowing what to try.

There an issue, maybe we have to deal with it another way.

It would be nice having some enlightenments from someone who knows what's behind.

@MacKentoch inspect your source path; confirm it resolves to the file/url you intend it to. Put it this way: If the source pointer is correct, you likely won't be running into a permissions issue.

@ssomnoremac, @LuisRizo, @harshsrivastavaglobussoft and I are all effectively saying the same thing

@MacKentoch image.sourceURL worked perfectly on iOS on simulator, but when ran on real device, it was complaining about permission errors regarding accessing a file using: file://... when I tried sending that image through HTTP requests.
Using image.path solved the issue.

Use image.path instead of image.sourceUri
This worked for me :)

Hi i have the same inssue with videos but if i put video.path the error disappear but have a horrible quality and when i put video.sourceURL have a good quality but show me the error, any solution for this? i need it with good quality

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings