joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.84k stars 787 forks source link

RN 0.56 problem #108

Open ditkachuk opened 6 years ago

ditkachuk commented 6 years ago

Hello, we have a problem with release build after update to 0.56, application crushed after rn-fetch-blob import with error:

2018-07-10 15:55:09.289750+0300 Experium[65328:2109773] Could not successfully update network info during initialization.
WARNING: Logging before InitGoogleLogging() is written to STDERR
E0710 15:55:13.072135 8146944 JSCHelpers.cpp:140] Got JS Exception: Can't find variable: self (/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:1155)
E0710 15:55:13.072471 8146944 JSCHelpers.cpp:146] Got JS Stack: /Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:1155:11945
/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:1155:11948
c@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:2:878
/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:1154:133
c@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:2:878
/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:1131:511
c@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:2:878
/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:1130:197
c@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:2:878
/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:649:1037
c@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:2:878
/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:12:58
c@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:2:878
i@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:2:381
global code@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:2268:8
E0710 15:55:13.076236 8146944 JSCHelpers.cpp:140] Got JS Exception: Exception calling object as function: Module AppRegistry is not a registered callable module (calling runApplication) (<unknown file>:340)
E0710 15:55:13.076391 8146944 JSCHelpers.cpp:146] Got JS Stack: exports@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:340:308
value@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:344:3100
/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:344:824
value@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:344:2510
value@/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:344:796
value@[native code]
2018-07-10 15:55:13.099 [fatal][tid:main] Unhandled JS Exception: Can't find variable: self (/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:1155)
2018-07-10 15:55:13.100428+0300 Experium[65328:2109773] Unhandled JS Exception: Can't find variable: self (/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:1155)
2018-07-10 15:55:13.111648+0300 Experium[65328:2109773] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Can't find variable: self (/Users/tkachuk/Library/Developer/CoreSimulator/Devices/93E22B3D-37D9-4D59-AC6B-E53B7211F030/data/Containers/Bundle/Application/BB53A32E-B497-4772-A54F-99B98A2971E2/Experium.app/main.jsbundle:1155)', reason: 'Unhandled JS Exception: Can't find variable: self (/Users/tkachuk/Library/D...'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001121351e6 __exceptionPreprocess + 294
    1   libobjc.A.dylib                     0x0000000110623031 objc_exception_throw + 48
    2   Experium                            0x000000010f5bba5d RCTFormatError + 0
    3   Experium                            0x000000010f5a6fef __28-[RCTCxxBridge handleError:]_block_invoke + 689
    4   libdispatch.dylib                   0x0000000116c86807 _dispatch_call_block_and_release + 12
    5   libdispatch.dylib                   0x0000000116c87848 _dispatch_client_callout + 8
    6   libdispatch.dylib                   0x0000000116c9292b _dispatch_main_queue_callback_4CF + 628
    7   CoreFoundation                      0x00000001120f7c99 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    8   CoreFoundation                      0x00000001120bbea6 __CFRunLoopRun + 2342
    9   CoreFoundation                      0x00000001120bb30b CFRunLoopRunSpecific + 635
    10  Foundation                          0x000000011001eb4a -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
    11  Foundation                          0x000000011009b67f -[NSRunLoop(NSRunLoop) runUntilDate:] + 79
    12  Experium                            0x000000010f6efb54 +[SplashScreen show] + 244
    13  Experium                            0x000000010f59b1dc -[AppDelegate application:didFinishLaunchingWithOptions:] + 604
    14  UIKit                               0x0000000114a4075b -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 278
    15  UIKit                               0x0000000114a421d2 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4123
    16  UIKit                               0x0000000114a4762b -[UIApplication _runWithMainScene:transitionContext:completion:] + 1677
    17  UIKit                               0x0000000114e09e4a __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
    18  UIKit                               0x00000001151dc909 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
    19  UIKit                               0x0000000114e09a86 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
    20  UIKit                               0x0000000114e0a2a7 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
    21  UIKit                               0x000000011577b4d4 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
    22  UIKit                               0x000000011577b36e -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
    23  UIKit                               0x000000011545f62d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
    24  UIKit                               0x000000011565a387 _performActionsWithDelayForTransitionContext + 100
    25  UIKit                               0x000000011545f4f7 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
    26  UIKit                               0x00000001151dbfb0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
    27  UIKit                               0x0000000114a45f0c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
    28  UIKit                               0x0000000115018a97 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
    29  FrontBoardServices                  0x000000011e4d52f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
    30  FrontBoardServices                  0x000000011e4ddcfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
    31  libdispatch.dylib                   0x0000000116c87848 _dispatch_client_callout + 8
    32  libdispatch.dylib                   0x0000000116c8ce14 _dispatch_block_invoke_direct + 592
    33  FrontBoardServices                  0x000000011e509470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
    34  FrontBoardServices                  0x000000011e50912e -[FBSSerialQueue _performNext] + 439
    35  FrontBoardServices                  0x000000011e50968e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    36  CoreFoundation                      0x00000001120d7bb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    37  CoreFoundation                      0x00000001120bc4af __CFRunLoopDoSources0 + 271
    38  CoreFoundation                      0x00000001120bba6f __CFRunLoopRun + 1263
    39  CoreFoundation                      0x00000001120bb30b CFRunLoopRunSpecific + 635
    40  GraphicsServices                    0x0000000118eb6a73 GSEventRunModal + 62
    41  UIKit                               0x0000000114a490b7 UIApplicationMain + 159
    42  Experium                            0x000000010f59b285 main + 80
    43  libdyld.dylib                       0x0000000116d04955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
megazoll commented 6 years ago

Seems like problem in https://github.com/joltup/rn-fetch-blob/blob/master/lib/oboe-browser.js#L2701 so removing export from here https://github.com/joltup/rn-fetch-blob/blob/master/index.js#L28 fixes the bug

20pro commented 6 years ago

i have the same problem :) A correction is planned ?

Traviskn commented 6 years ago

Yeah react-native 0.56 had quite a few breaking changes.

@megazoll I'm concerned that removing the JSON stream import will break other functionality of the library.

Digging down into the lib/oboe-browser.js code it seems like it's expecting a global self variable to be available, I wonder if a better fix would be to somehow remove the reference to self, or perhaps add a check to see if self is defined before trying to return it? I'm not super familiar with oboe-browser, I'm not sure if that was originally written by the library authors or if it is a vendored dependency and the files were just copied in from the oboe library.

kangandroid commented 6 years ago

same problem. And can be resolve according that.But What's the true reason is ?