react-native-blob-util
react-native-blob-util copied to clipboard
Not getting headers , status , respType , redirects in the respInfo of response occasionally in iOS.
Not getting headers , status , respType , redirects in the respInfo of response occasionally in iOS. on that time getting "rnfbEncode" only in the respInfo.
i'm attaching 2 screenshots here , both screenshots are responsible for same api and getting the same data in the data part , but the respInfo are not getting properly.
I'm experiencing this as well. It seems to happen more often on fresh installations of an app.
It seems like the event which sets the responsive info isn't being received by the JS.
From my debugging with adding logging throughout the code, it seems like this event is being dispatched: https://github.com/RonRadtke/react-native-blob-util/blob/master/ios/ReactNativeBlobUtilRequest.mm#L272-L282
But it is not being received in the JS code which ultimately sets the response info: https://github.com/RonRadtke/react-native-blob-util/blob/master/fetch.js#L203-L207
It seems like the HTTP request is successful, as I can see a 200 status being logged, but the JS layer isn't able to report the successful state of the download back to the code which initiated the request.
hi @RonRadtke, can you check this please? Getting only rnfbEncode
in respInfo
quite often recently
I'm using a workaround which checks that the response is exactly that, and the platform is IOS. Then check if the file exists and is of non-zero size.
if (Platform.OS === 'ios' && JSON.stringify(response.respInfo) === JSON.stringify({rnfbEncode: 'path'})) {
// check file exists and has non-zero size
// if so, treat as successful operation
respInfo
In my case i want to check for the status of the response. for now i have downgraded to 0.17.1 and i haven’t faced this issue with this version.
How do you get the proper response header on iOS?
How do you get the proper response header on iOS?
Use 0.17.1th version
Use 0.17.1th version
@rifad4u I'm using 0.17.1 version. do you any other workarounds to get response headers? @RonRadtke @cjpete 😓
Are you using libraries like RNN or maybe two navigators (button tabs + stack) or so? I could imagine that there are problems if the root view can't be accessed and therfor the bridge might be null. That could ultimatley lead to events not being sent to JS correctly.
@RonRadtke Then y this issue is happening occasionally only, if that is the case then it should happen every time , right?
@rifad4u that's right, except if you're changing navigators somewhen during the life cycle.
But I honselty don't have a better idea right know either. I might be solved once I rewrote the whole vent system to a newer and hopefully more stable system using modern APIs / classes
@RonRadtke in my case i'm facing this while opening the application only , not happening in between and it is not replicating if i close and relaunch the application.
@rifad4u it sounds wired as a behaviour. I'm sorry but I currently don't have an explanation for it. If you have the chance it would be great to try to debug it, I can't reproduce it in my app yet. Would be good to know if the bridge / eventDispatcher are set up correctly or if these are not set correctly. And if not, why...
Hi @RonRadtke,
We have the same issue on our side. We use react-native-navigation
.
After some tests, I can track the issue from this change => https://github.com/RonRadtke/react-native-blob-util/commit/6290b21c3b5e60626a19bb6ea43f1579e15a8626
It's seem like:
-
rootView.bridge.eventDispatcher
=> can cause some crash at startup (we had them when we was on0.70.1
) -
bridge.eventDispatcher;
=> is not reliable & can lost some events
I will try to set up some minimal reproduction.
~In our app we have multiple navigator & use react-native-blob-util
in different places. This could explain that react-native-blob-util
can keep an incorrect ref to the bridge ?~
I tried to use react-native-blob-util
only in one place without success
We're having the exact same issue on 0.17.3. Downgrading to 0.17.1 fixes the issue for us.
~~I managed to reproduce it now in a local app but unsure yet how to fix it~~
Had the same issue and downgrading to 0.17.1 worked for me as well
@cjpete could you test if the eventDispatcher is set and maybe if you get a bridge in https://github.com/RonRadtke/react-native-blob-util/blob/132051c1204051f5148a0b4bfede00ed99f47c44/ios/ReactNativeBlobUtil/ReactNativeBlobUtil.mm#L71 ? Sadly my repro for reproduction was a fail and I'm still struggling to reproduce it....
Same issue :(
Any new Informationen? Anyone? Could it be that it only happens when the appnis in the background or any idea based on yours app usage pattern? I'm currently rewriting the whole event handling structure but i would feel better about it if i know where the problem currently is
@RonRadtke, we do experience the same issue on 0.17.3 and we send multipart/form-data to the Java backend. It happens when the app is in the foreground and can be reproduced both on the device and the simulator. We tried on devices with ios versions 16.2 and 15.7, but an android app was working well. There are no clear steps to reproduce the issue, because it may work properly and in an hour accidentally stop working on the same device with the same data.
env: [email protected] "react-native-navigation": "^7.32.1" "@reduxjs/toolkit": "^1.9.3" "react": "18.1.0"
Hope this helps
Hi RonRadtke/react-native-blob-util,
This issue is happening when the app opens for the first time or opens from killed state , not happening this issue in between. means if you get proper response when the app opens then this issue won’t come in this session.
On Sun, May 7, 2023 at 1:11 PM Ron Radtke @.***> wrote:
Any new Informationen? Anyone? Could it be that it only happens when the appnis in the background or any idea based on yours app usage pattern? I'm currently rewriting the whole event handling structure but i would feel better about it if i know where the problem currently is
— Reply to this email directly, view it on GitHub https://github.com/RonRadtke/react-native-blob-util/issues/236#issuecomment-1537347176, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3JTW6CDEBIRO5QHLGIFJTXE5G27ANCNFSM6AAAAAAWDRDZBY . You are receiving this because you were mentioned.Message ID: @.***>
@rifad4u @emelyanova Thank you for the information. Could you try to remove /comment out this line: https://github.com/RonRadtke/react-native-blob-util/blob/132051c1204051f5148a0b4bfede00ed99f47c44/index.js#L45 And see if youbstill can reproduce it? I so far didn't manage to reproduce it at allregardless how often i try
emitExpiredEvent
Commented the line , but still facing the same issue 😕.
Too bad 😕 @rifad4u I assume you can't create an example repo for reproducing it either? But I hope I get the new event emitting rework for ios done next week or the week after. Maybe you could test if that helps once I'm done?
Too bad 😕 @rifad4u I assume you can't create an example repo for reproducing it either? But I hope I get the new event emitting rework for ios done next week or the week after. Maybe you could test if that helps once I'm done?
I'm trying to reproduce the same in a new project. meanwhile if you apply any fix you can comment here , i will check.
Thank you. Otherwise what could be interesting is if you have an eventdispatcher in this line or if it is e.g. null. So basically if the issue is somewhere there of in js https://github.com/RonRadtke/react-native-blob-util/blob/132051c1204051f5148a0b4bfede00ed99f47c44/ios/ReactNativeBlobUtilRequest.mm#L273
@rifad4u I got the ios part of the new eventemitter structure done and did a basic testing on it. you can use it by setting the version of react-native-blob-util to "ronradtke/react-native-blob-util#feature/eventemitter_rework"
Would be great if you could test if you can reproduce the issue on that branch too.
@rifad4u I got the ios part of the new eventemitter structure done and did a basic testing on it. you can use it by setting the version of react-native-blob-util to "ronradtke/react-native-blob-util#feature/eventemitter_rework"
Would be great if you could test if you can reproduce the issue on that branch too.
Hi @RonRadtke ,
Still facing the same issue , please find the screenshots below.
Both screenshots are the same request or what are you showing here? Did you check if the event is being fired within the native code?
Both screenshots are the same request or what are you showing here? Did you check if the event is being fired within the native code?
First screenshot is from the fetch.js file , line no : 205 ,
Second screenshot is the response i got when i called the api.