You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing request token for request, while uploading image file getting error. #29021
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've updated the app to RN 0.63 and reproduce this 100% o the time, either on emulator or iPhone...
To be more clear, the image doesn't even go out of the device, using Charles proxy doesn't show any network usage upon upload.
Reacted by Oliver Winter, YannDeck, Vladislav Shabanov, Anton, Fedir Ushakov, Paito Anderson, Nick Miller and Ismail Ghallou
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.
Reacted by Mike Hardy, Fedir Ushakov, Anton, Oleksandr Nashyvan and Shoaib Virk
Reacted by Oleksandr Nashyvan, Vladyslav Vasylenko, Jérémie Sellam, Stefan K, Fedir Ushakov, Finnian Anderson, Abraham Alonzo Velazquez, Utopia, Ioannis Kokkinidis, Faraz Ali and 5 more
same here i am using react-native-aws3 to upload the image and it always have this error.
this error start happening when i updated the rn to 0.63 was working fine in previous version of rn.
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.
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
When loading a file from the local filesystem loadImageWithURLRequest can (and does) load the file synchronously, and calls the callback block immediately. Since the function hasn't returned yet requestToken is not initialized, hence the "Missing request token" error
When loading a file from the local filesystem loadImageWithURLRequest can (and does) load the file synchronously, and calls the callback block immediately. Since the function hasn't returned yet requestToken is not initialized, hence the "Missing request token" error
Hey @leops
Please let me know if you need any help. Looking forward to a solution, but can't manage it due to another work tasks :(
Reacted by Oleksii, hamzawaleed-crewlogix, Andrew M., Nguyen Nam, Aneeque Ahmad, Magnús Ólafsson, Abiú Roldán, Cheruiyot Collins, Vikrant Negi, Stefan K and 10 more
Reacted by Oleksii, Magnús Ólafsson, Finnian Anderson, Kamil Dobrzyński and Ankit Rajendra Thanekar
Reacted by Oleksii, Andrew M., freddynyembi, Finnian Anderson, Florian Gyger, Kamil Dobrzyński and Ankit Rajendra Thanekar
Reacted by Oleksii, Andrew M., Ilir Hushi, Finnian Anderson, Kamil Dobrzyński, Ruda, Ankit Rajendra Thanekar and Dilawer Hussain
Reacted by Oleksii, Finnian Anderson, Kamil Dobrzyński and Ankit Rajendra Thanekar
Reacted by Oleksii, Kamil Dobrzyński and Ankit Rajendra Thanekar
This working for me
data.append('image',
{
uri: Platform.OS === 'android' ? photo.uri : photo.uri.replace('file://', '/private'),
name: 'image.jpg',
type: 'image/jpg',
});
I also faced same issue. But I manually updated the RCTNetworkTask.mm file. I know it is not correct method but at least I can upload the image now until React-Native developer share their fix to us.
Activity
khuyendev commentedon Jun 4, 2020
same issue here
MaxEgg commentedon Jun 13, 2020
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.
linoleum00 commentedon Jun 25, 2020
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!
sahilpandya commentedon Jun 29, 2020
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:
return new Promise(function(resolve, reject) { setTimeout(() => { return request.put(file, options) .then(response => { // success resolve() }) .catch((err) => { reject(err); }); }, 1500); }) .catch(error => { // error })linoleum00 commentedon Jun 29, 2020
I also read this same workaround, and as you said it is not a 100% solution, sometimes it still crashes
HugoGresse commentedon Jul 9, 2020
I've updated the app to RN 0.63 and reproduce this 100% o the time, either on emulator or iPhone...
To be more clear, the image doesn't even go out of the device, using Charles proxy doesn't show any network usage upon upload.
wezzy commentedon Jul 9, 2020
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
kelset commentedon Jul 10, 2020
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.
v-anton commentedon Jul 13, 2020
100% reproducible on 0.63 (iOS).
dharminderraja commentedon Jul 13, 2020
same here i am using react-native-aws3 to upload the image and it always have this error.
this error start happening when i updated the rn to 0.63 was working fine in previous version of rn.
struct78 commentedon Jul 13, 2020
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
leops commentedon Jul 13, 2020
I stumbled upon this problem too, quickly looking at it it seems to me the origin for the problem is this function:
https://github.com/facebook/react-native/blob/f898bb65fac3f26944cbe1c47b87c63b2cd10e03/Libraries/Image/RCTImageLoader.mm#L1101-L1131
When loading a file from the local filesystem
loadImageWithURLRequestcan (and does) load the file synchronously, and calls the callback block immediately. Since the function hasn't returned yetrequestTokenis not initialized, hence the "Missing request token" errorv-anton commentedon Jul 13, 2020
Hey @leops
Please let me know if you need any help. Looking forward to a solution, but can't manage it due to another work tasks :(
63 remaining items
eco-line commentedon Sep 30, 2020
This got fixed in v0.63.3
cherucole commentedon Oct 9, 2020
I upgraded RN to this version and never saw the issue again
safaiyeh commentedon Oct 9, 2020
Thanks everyone for your patiences. Glad the fix is in, closing
thaiphamvan commentedon Oct 23, 2020
thanks , It works for me.
Balasnest commentedon Nov 3, 2020
getting this npm error after change package json from 0.63.2 to 0.63.3.
npm ERR! code EINTEGRITY
npm ERR! Verification failed while extracting jsc-android@241213.1.0:
npm ERR! Verification failed while extracting jsc-android@241213.1.0:
npm ERR! sha512-AH8NYyMNLNhcUEF97QbMxPNLNW+oiSBlvm1rsMNzgJ1d5TQzdh/AOJGsxeeESp3m9YIWGLCgUvGTVoVLs0p68A== integrity checksum failed when using sha512: wanted sha512-AH8NYyMNLNhcUEF97QbMxPNLNW+oiSBlvm1rsMNzgJ1d5TQzdh/AOJGsxeeESp3m9YIWGLCgUvGTVoVLs0p68A== but got sha512-ptI+efRlVdodigsznoyx5zuvQcHCk3NgWkC8GR/qr2pRl87wCpMDqzDs/zvKfm3zkBALvOaF2E/gD5DePG4G4Q==. (4273248 bytes)
Any idea?
Leehee1on commentedon Dec 11, 2020
node_modules/react-native/Network/NetworkTesk.mm
Line 102 ~ 107
if (requestToken == nil) {
if (RCT_DEBUG) {
// RCTLogError(@"Missing request token for request: %@", _request); // change
}
valid = YES; // change NO -> YES
}
My solution is RN < 63.2
GuilhermeTrivilin commentedon Jan 5, 2021
Error fixed when updating React Native to version 0.63.3
tbsphpdev commentedon Jan 12, 2021
This working for me
data.append('image',
{
uri: Platform.OS === 'android' ? photo.uri : photo.uri.replace('file://', '/private'),
name: 'image.jpg',
type: 'image/jpg',
});
Mahmud-cdx commentedon Mar 6, 2021
thank you very much. It is working
michaelVictoriaDev commentedon Mar 17, 2021
still get error in 0.63.4
victorglomer commentedon Mar 27, 2021
In my case, thats what worked
rdewolff commentedon May 15, 2021
This worked for me too! Thanks for sharing.