swup
March 17, 2022, 11:20pm
1
Hi, so we are trying to have a simple attachment upload for an in-app support chat feature, but Expo seems to crash 90% of the times a user is trying to upload something, both in dev as well as in production.
I found the exact same issues opened for quite a few months on both Firebase as well as Expo’s github.
opened 05:10AM - 26 Nov 21 UTC
**Describe the bug**
Expo go crash when uploading videos, on both emulator and … physical device, no error messages in node console.
Standalone app also crashes.
No issues with photos
**To Reproduce**
Steps to reproduce the behavior:
1. Change media type to video
2. Select a video
3. Expo crash
**Expected behavior**
Able to upload both videos and photos
**Screenshots**
<img width="1043" alt="Screen Shot 2021-11-27 at 1 02 57 pm" src="https://user-images.githubusercontent.com/26791482/143664706-9824b13a-b119-4f03-812f-d946c67d0713.png">
https://user-images.githubusercontent.com/26791482/143529912-c516d1a0-c7d7-4273-8787-ba918a6f2e0a.mov
**Desktop (please complete the following information):**
- OS: MacOs 12.0.1
- Browser chrome
**Smartphone (please complete the following information):**
- Device: iPhone 13 Emulator and Physical Device
- OS: IOS 15.0
- Expo SDK Version 43
**Additional context**
Add any other context about the problem here.
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Incident Identifier: 149D1A97-0931-4959-99D1-E7D55BD06C67
CrashReporter Key: 027547F0-F0A0-0284-9F93-DFF21C994CB5
Hardware Model: iMac19,1
Process: Expo Go [2409]
Path: /Users/USER/Library/Developer/CoreSimulator/Devices/B7CEDF12-0EDC-462E-B621-A5C4F606D8FC/data/Containers/Bundle/Application/D93A18CA-DB05-4B0E-B314-725AFFE52FB4/Exponent-2.22.4.tar.app/Expo Go
Identifier: host.exp.Exponent
Version: 2.22.4 (2.22.4.101)
Code Type: X86-64 (Native)
Role: Foreground
Parent Process: launchd_sim [2235]
Coalition: com.apple.CoreSimulator.SimDevice.B7CEDF12-0EDC-462E-B621-A5C4F606D8FC [1589]
Responsible Process: SimulatorTrampoline [2221]
Date/Time: 2021-11-27 13:00:12.2718 +1100
Launch Time: 2021-11-27 12:58:01.4344 +1100
OS Version: macOS 12.0.1 (21A559)
Release Type: User
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 12
Application Specific Information:
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
CoreSimulator 776.4 - Device: iPhone 13 (B7CEDF12-0EDC-462E-B621-A5C4F606D8FC) - Runtime: iOS 15.0 (19A339) - DeviceType: iPhone 13
terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
abort() called
Last Exception Backtrace:
0 CoreFoundation 0x11aec1ba4 __exceptionPreprocess + 226
1 libobjc.A.dylib 0x110560be7 objc_exception_throw + 48
2 CoreFoundation 0x11af41f38 _CFThrowFormattedException + 194
3 CoreFoundation 0x11af4c42e -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
4 CoreFoundation 0x11af2f914 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 251
5 CoreFoundation 0x11aec083b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
6 Expo Go 0x108ab0894 -[ABI43_0_0RCTBlobManager handleNetworkingRequest:] + 386
7 Expo Go 0x108ac8040 -[ABI43_0_0RCTNetworking processDataForHTTPQuery:callback:] + 325
8 Expo Go 0x108ac78bb -[ABI43_0_0RCTNetworking buildRequest:completionBlock:] + 1189
9 Expo Go 0x108acab8d -[ABI43_0_0RCTNetworking sendRequest:callback:] + 944
10 CoreFoundation 0x11aec847c __invoking___ + 140
11 CoreFoundation 0x11aec5872 -[NSInvocation invoke] + 305
12 CoreFoundation 0x11aec5b05 -[NSInvocation invokeWithTarget:] + 70
13 Expo Go 0x108a30fce -[ABI43_0_0RCTModuleMethod invokeWithBridge:module:arguments:] + 595
14 Expo Go 0x108a33844 ABI43_0_0facebook::ABI43_0_0React::invokeInner(ABI43_0_0RCTBridge*, ABI43_0_0RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 574
15 Expo Go 0x108a33479 invocation function for block in ABI43_0_0facebook::ABI43_0_0React::ABI43_0_0RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 92
16 libdispatch.dylib 0x11c0cc876 _dispatch_call_block_and_release + 12
17 libdispatch.dylib 0x11c0cda56 _dispatch_client_callout + 8
18 libdispatch.dylib 0x11c0d408b _dispatch_lane_serial_drain + 718
19 libdispatch.dylib 0x11c0d4c31 _dispatch_lane_invoke + 400
20 libdispatch.dylib 0x11c0df6de _dispatch_workloop_worker_thread + 772
21 libsystem_pthread.dylib 0x7fff6bff208f _pthread_wqthread + 326
22 libsystem_pthread.dylib 0x7fff6bff101b start_wqthread + 15
opened 11:52PM - 02 Jan 22 UTC
api: storage
v9
### [REQUIRED] Describe your environment
* Operating System version: iOS 14… .8.1
* Expo CLI 5.0.3 environment info:
System:
OS: macOS Sierra 10.12.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.16.2 - /usr/local/bin/node
npm: 6.14.4 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0
npmPackages:
expo: ~44.0.0 => 44.0.1
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-web: 0.17.1 => 0.17.1
npmGlobalPackages:
expo-cli: 5.0.3
* Firebase SDK version: 9.6.1
* Firebase Product: storage (auth, database, storage, etc)
### [REQUIRED] Describe the problem
I am using Expo Image picker to select an image, convert to blob, then the Firebase 9.0 SDK function uploadBytes to add the image to my storage bucket. Around 60-80% of the time, the uploadBytes function causes my app to crash with no errors or logs recorded. When the app does not crash, the upload to Storage is successful.
Similar code and crashing symptoms as: https://stackoverflow.com/questions/70528896/react-native-expo-image-picker-upload-image-to-firebase-storage-v9-crash
#### Steps to reproduce:
<!--
Call the function below (uploadNewPhoto) a few items, and the app will likely crash on one of the calls. There will be no recorded logs but the app will still crash. Upon commenting out uploadBytes, the app does not crash.
-->
#### Relevant Code:
```javascript
const uploadNewPhoto = async() => {
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: false,
// aspect: [4, 3],
quality: 0.1,
});
if (!result.cancelled) {
// Convert URI to a Blob via XHTML request, and actually upload it to the network
const blob = await new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.onload = function() {
resolve(xhr.response);
};
xhr.onerror = function() {
reject(new TypeError('Network request failed'));
};
xhr.responseType = 'blob';
xhr.open('GET', result.uri, true);
xhr.send(null);
});
const thisUsersNewPostRef = ref(storageRef, 'users/img1' );
uploadBytes(thisUsersNewPostRef, blob).then((snapshot) => { // causes crash
console.log('Uploaded a blob or file!');
});
}
}
```
Does anyone have any solution to this? How do we go about it …