-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing request token for request, while uploading image file getting error. #29021
Comments
same issue here |
Having this issue constantly in version: 0.63.0-rc.0. Can not upload a file. Tried using the fetch api and Axios. Both throw this error when adding formData with image data to the request. Adding formData with a string value still works as expected. |
I'm using RN 0.62.2, and I'm having this issue. I'm using rxjs/ajax to upload to a multipart POST API and it crashes! |
I got one work around, adding setTimeout for each request, So now am able to upload 90% times. But it is still not 100% workaround. here is a sample code: |
I also read this same workaround, and as you said it is not a 100% solution, sometimes it still crashes |
I've updated the app to RN 0.63 and reproduce this 100% o the time, either on emulator or iPhone... |
Same here, after the upgrade if I make a request using fetch("SOME LOCAL PATH") I get the error. It's woking correctly with the older version |
Since this seems to be surfacing more with the new 0.63, can someone who is facing this issue please post a full repro? Meaning, a sample react-native init'd project with the minimal code to reproduce the issue posted above. |
100% reproducible on 0.63 (iOS). |
same here i am using react-native-aws3 to upload the image and it always have this error. |
Have tested this using fetch to read an image with the file protocol and get the same error. Replacing the file:/// URL with a https:// URL works fine. I don't have time to put it in an easily reproducible demo unfortunately. https://github.com/trueme-app/trueme-react-native/blob/develop/src/services/s3.ts#L36 Having dug a bit deeper (and not fully understanding how RN workers under the hood, so I apologise in advance if I'm wrong!), I wonder if this commit is the culprit? 058eeb4 @p-sun |
I stumbled upon this problem too, quickly looking at it it seems to me the origin for the problem is this function: react-native/Libraries/Image/RCTImageLoader.mm Lines 1101 to 1131 in f898bb6
When loading a file from the local filesystem |
Hey @leops |
Having the same issue |
|
Here is a minimal repo that demonstrates this error. Choose a file from the camera roll and then try to retrieve that using fetch. https://github.com/struct78/react-native-0.63.1-missing-request-token |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@uusa35 can you provide a code sample? I was pulling the uri too and it was still failing for me |
Originally our fetch Using @uusa35 method and restructuring the body to So it seems that the body needs to be an array(?) instead of a simply hash to go through? @uusa35 can you please elaborate on your fetch request and possibly include an example? |
IOS : photo.uri.replace("file://", "/private") |
0.63.2 still exist |
@kockok could you please explain more on your solution, i'm using ReactNativeFile with apollo-upload-client to upload file |
still issue |
@FabrizioCaldarelli -- I also didn't want to patch, so thank you for the |
Edit this file: |
I have tried " __block RCTImageLoaderCancellationBlock requestToken = ^{};" on "node_modules/react-native/Libraries/Image/RCTImageLoader.mm" this file. Then I deleted my App on IOS and again I run the application using "yarn ios". But, still having the issue. Did I missed something? @kockok @tamhv @akkravikumar |
I have the same issue. When it will be fixed? |
thanks, it works for me. |
@VonJie Thanks man dataForm.append('file', { uri: Platform.OS=='ios'?photo.uri.replace("file://", "/private"):photo.uri, name: 'photo.jpg', type: 'image/jpg' }); this is work for me too.. |
in Replace Below
return nil; With
This.. Like and Love , if it work 👍 |
This got fixed in v0.63.3 |
I upgraded RN to this version and never saw the issue again |
Thanks everyone for your patiences. Glad the fix is in, closing |
thanks , It works for me. |
getting this npm error after change package json from 0.63.2 to 0.63.3. npm ERR! code EINTEGRITY Any idea? |
node_modules/react-native/Network/NetworkTesk.mm Line 102 ~ 107 if (requestToken == nil) { My solution is RN < 63.2 |
Error fixed when updating React Native to version 0.63.3 |
This working for me |
thank you very much. It is working |
still get error in 0.63.4 |
In my case, thats what worked
|
This worked for me too! Thanks for sharing. |
Missing request token for request, while uploading image file getting error.
Description
While image is uploading to server, sometime its throwing error Missing request token.
React Native version: v0.61.5
Run
react-native info
in your terminal and copy the results here.System:
OS: macOS Mojave 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 147.43 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.3 - ~/.nvm/versions/node/v10.16.3/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.3/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
IDEs:
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.12.0 => 16.12.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-cli: 2.0.1
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
Expected Results
Images should be uploaded successfully.
Snack, code example, screenshot, or link to a repository:
The text was updated successfully, but these errors were encountered: