invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.61k stars 2.19k forks source link

[🐛] Storage putFile with customMetadata fail with unknown error #7416

Closed lsps9150414 closed 10 months ago

lsps9150414 commented 10 months ago

Issue

When uploading files to Storage with a customMetadata, an unknown error occurs. Without the metadata the upload works as expected.

This code throws an error:

  const ref = storage().ref(storagePath);
  const uploadTask = ref.putFile(localPath, { customMetadata: { creatorUid: "some-uuid" } });

The error:

Error: [storage/unknown] An unknown error has occurred.
NativeFirebaseError: [storage/unknown] An unknown error has occurred.

I am using react-native-firebase with Expo, running in a development build. Expo app config provided below.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "version": "1.0.0", "main": "expo-router/entry", "scripts": { "start": "expo start", "start:local": "EXPO_PUBLIC_USE_EMULATOR=true NODE_ENV=development npm run start", "start:dev": "NODE_ENV=development npm run start", "start:dev:minify": "NODE_ENV=development npm run start -- --no-dev --minify", "start:dev:tunnel": "NODE_ENV=development npm run start -- --tunnel", "start:staging": "NODE_ENV=test npm run start", "start:prod": "NODE_ENV=production npm run start", "build:dev:ios:simulator": "eas build --profile development-simulator --platform ios", "build:dev:ios": "eas build --profile development --platform ios", "build:dev:android": "eas build --profile development --platform android", "build:staging:ios:simulator": "eas build --profile staging-simulator --platform ios", "build:prod:ios:simulator": "eas build --profile production-simulator --platform ios", "lint": "eslint .", "ts:check": "tsc --noEmit --pretty", "test": "echo no tests yet" }, "dependencies": { "@expo-google-fonts/pt-mono": "^0.2.3", "@ptomasroos/react-native-multi-slider": "^2.2.2", "@react-native-async-storage/async-storage": "1.18.2", "@react-native-firebase/app": "^18.5.0", "@react-native-firebase/auth": "^18.5.0", "@react-native-firebase/crashlytics": "^18.5.0", "@react-native-firebase/firestore": "^18.5.0", "@react-native-firebase/functions": "^18.5.0", "@react-native-firebase/perf": "^18.5.0", "@react-native-firebase/storage": "^18.5.0", "@react-native-masked-view/masked-view": "0.2.9", "@reduxjs/toolkit": "^1.9.5", "@th3rdwave/react-navigation-bottom-sheet": "^0.2.7", "expo": "^49.0.13", "expo-blur": "~12.4.1", "expo-build-properties": "~0.8.3", "expo-clipboard": "~4.3.1", "expo-constants": "~14.4.2", "expo-crypto": "~12.4.1", "expo-dev-client": "~2.4.11", "expo-haptics": "~12.4.0", "expo-image": "~1.3.4", "expo-image-picker": "~14.3.2", "expo-linear-gradient": "~12.3.0", "expo-linking": "~5.0.2", "expo-location": "~16.1.0", "expo-media-library": "~15.4.1", "expo-router": "^2.0.0", "expo-sharing": "~11.5.0", "expo-splash-screen": "~0.20.5", "expo-status-bar": "~1.6.0", "expo-updates": "~0.18.16", "hex-rgba": "^1.0.2", "lodash": "^4.17.21", "luxon": "^3.4.3", "react": "18.2.0", "react-async-hook": "^4.0.0", "react-dom": "18.2.0", "react-native": "0.72.5", "react-native-confirmation-code-field": "^7.3.1", "react-native-elements": "^3.4.3", "react-native-gesture-handler": "~2.12.0", "react-native-image-colors": "^2.3.0", "react-native-modal": "^13.0.1", "react-native-reanimated": "~3.3.0", "react-native-redash": "^18.1.0", "react-native-safe-area-context": "4.6.3", "react-native-screens": "~3.22.0", "react-native-svg": "13.9.0", "react-native-svg-transformer": "^1.1.0", "react-native-swiper-flatlist": "^3.2.3", "react-native-web": "~0.19.6", "react-redux": "^8.1.2", "redux-persist": "^6.0.0", "redux-saga": "^1.2.3", "tinycolor2": "^1.6.0", "tinygradient": "^1.1.5", "validator": "^13.11.0" }, "devDependencies": { "@babel/core": "^7.20.0", "@types/hex-rgba": "^1.0.1", "@types/lodash": "^4.14.198", "@types/luxon": "^3.3.2", "@types/react": "~18.2.14", "@types/validator": "^13.11.1", "eslint": "^8.48.0", "eslint-config-universe": "^12.0.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-native": "^4.1.0", "reactotron-react-native": "^5.0.3", "reactotron-redux": "^3.1.3", "reactotron-redux-saga": "^4.2.3", "typescript": "^5.1.3" }, "private": true } ``` #### `app.config.js` for Expo: ```js return { ...config, ...envConfig, version: "1.0.0", orientation: "portrait", icon: "./assets/image/appIcon.png", userInterfaceStyle: "light", assetBundlePatterns: ["**/*"], splash: { image: "./assets/image/splash.png", resizeMode: "contain", backgroundColor: "#ffffff", }, ios: { supportsTablet: false, ...envConfig.ios, }, android: { adaptiveIcon: { foregroundImage: "./assets/image/appIcon.png", backgroundColor: "#ffffff", ...envConfig.android?.adaptiveIcon, }, ...envConfig.android, }, web: { bundler: "metro", favicon: "./assets/image/favicon.png", }, experiments: { tsconfigPaths: true, typedRoutes: true, }, plugins: [ "expo-router", "@react-native-firebase/app", "@react-native-firebase/perf", "@react-native-firebase/crashlytics", "@react-native-firebase/auth", [ "expo-image-picker", { photosPermission: "Allow $(PRODUCT_NAME) to access your photos.", cameraPermission: "Allow $(PRODUCT_NAME) to access your camera", microphonePermission: "Allow $(PRODUCT_NAME) to access your microphone", }, ], [ "expo-media-library", { photosPermission: "Allow $(PRODUCT_NAME) to access your photos.", savePhotosPermission: "Allow $(PRODUCT_NAME) to save photos.", isAccessMediaLocationEnabled: true, }, ], ["expo-build-properties", { ios: { useFrameworks: "static" } }], ], extra: { router: { origin: false, }, ...envConfig.extra, }, }; ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 14.0 CPU: (10) arm64 Apple M1 Pro Memory: 100.05 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.16.0 path: ~/.nvm/versions/node/v18.16.0/bin/node Yarn: Not Found npm: version: 9.5.1 path: ~/.nvm/versions/node/v18.16.0/bin/npm Watchman: Not Found Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.7199119 Xcode: version: 15.0.1/15A507 path: /usr/bin/xcodebuild Languages: Java: version: javac 21 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.5 wanted: 0.72.5 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: Not found newArchEnabled: Not found iOS: hermesEnabled: Not found newArchEnabled: Not found ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y/N` & `VERSION`


lsps9150414 commented 10 months ago

Sorry, the error is actually unrelated to metadata.