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
In our project, it seems like if the .fetch call receives a status 404, 401 etc. it goes to the .catch as expected.
Meanwhile, if the .fetch call's response is a 500 Internal Server Error, it does not move on at all. It neither goes the the .then bracket, nor the .catch. See code snippet for illustration
constconfigOptions: ReactNativeBlobUtilConfig=Platform.OS==='ios'
? {fileCache: true,appendExt: '.pdf',path: <path>}
: //android{addAndroidDownloads: {useDownloadManager: true,notification: true,mime: 'application/pdf',},};ReactNativeBlobUtil.config(configOptions).fetch('GET',`url....`,{
headers...
}).then((res)=>{console.log('This does not happen when 500 response');}).catch((e)=>{console.log('this does not happen when 500 response');});
We tried multiple setups, but could never get it to work. The only way to handle it that we found was to simply cancel the request after a set time.
// Cancel request after 3 minutes in case of internal server errorsetTimeout(()=>{task.cancel();},1000*60*3);
The text was updated successfully, but these errors were encountered:
liv002
changed the title
Trouble handling 500 Internal Server Error
Trouble handling 500 Internal Server Error Response
Aug 26, 2024
Same case for me! Is the timeout the only solution to this? I don't like that approach tbh. It just hangs infinetly, no log on javascript side or something like that
Info:
react-native: 0.73.9
react-native-blob-util: 0.9.11
Tested on Android 10 to 14.
Specs
Issue
In our project, it seems like if the
.fetch
call receives a status 404, 401 etc. it goes to the.catch
as expected.Meanwhile, if the
.fetch
call's response is a500 Internal Server Error
, it does not move on at all. It neither goes the the.then
bracket, nor the.catch
. See code snippet for illustrationWe tried multiple setups, but could never get it to work. The only way to handle it that we found was to simply cancel the request after a set time.
The text was updated successfully, but these errors were encountered: