-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[🐛] Storage getDownloadURL() does not work with Firebase Emulator #6638
Comments
Can confirm; having the same error using the latest version of RNF but not when using the web SDK. |
Hey there - sorry for the hassle, I thought this was in the release notes but it is not. It was a known issue in the v16 release here but we needed to go ahead with release to get firestore counts support out Anyway - this is an iOS specific upstream issue, it will be fixed when firebase-ios-sdk 10.1.0 is released, hopefully shortly This is the issue tracking: firebase/firebase-ios-sdk#10374 It is already merged, just pending release In the meantime, you may stay on react-native-firebase v15.7.0 or use Android |
Thank you so much for the timely response and clarification! |
Sorry for reopening this. Downgrading to v15.7.0 solved the |
Hmm - and it's fine to reopen, it is actually still an issue in the current release so being open for getDownloadURL alone is not a bad idea, while we wait for firebase-ios-sdk v10.1.0 to release To your question on putResult.ref - my normal action is to go and check our e2e tests to see if they exercise it, and because the e2e coverage is very high in general I have the hope it does exercise it, and I can say "works for me" 😅 In this case it looks like an API usage thing - I don't see "ref" on the object returned from putFile: https://rnfirebase.io/reference/storage/reference#putFile returns Task So it seems expected Task.snapshot is a TaskSnapshot and it has a ref? |
Thanks for pointing that out, checking e2e tests is definitely a good way to self-diagnose! I rechecked the definition - https://rnfirebase.io/reference/storage/reference#putFile does return Task, which is a promise that gets resolved to a TaskSnapshot (lib/index.d.ts#L848) then(
onFulfilled?: ((a: TaskSnapshot) => any) | null,
onRejected?: ((a: NativeFirebaseError) => any) | null,
): Promise<any>; TaskSnapshot has a ref but it is always null when using emulators |
🤔
What happens if you treat it as a Task vs a TaskSnapshot, and instead chain Task.snapshot.ref ? This may need to be a separate issue, and first step will be to determine if our types are correct, perhaps it should be return typed as Promise (?) with second job being to determine where the issue is, as it may be firebase-ios-sdk, firebase-tools, or react-native-firebase, there are a few issues that are in between like that and it is difficult to determine. Examining upstream APIs then comparing cloud vs emulator behavior takes some time... Likely something in firebase-ios-sdk at the moment, but maybe not a bug really - they converted Storage to Swift so the typing is more strict now and is exposing things that are differences in previous behavior from APIs as well, which is cleaning out downstream expectation errors (in this module) at the same time that sometimes it's a Swift conversion issue. Which is a bit vague, sorry, but if it were cleanly documented in a new issue that could help |
firebase admin based backend. I have an issue where the obtained signed URL links to production google servers rather than the emulated storage, and calling getDownloadURL to obtain the public url just straight up crashes the emulator. Some relevant links to investigate that particular issue. firebase/firebase-admin-node#1352 firebase/firebase-tools#3396 invertase/react-native-firebase#6638 https://stackoverflow.com/questions/42956250/get-download-url -from-file-uploaded-with-cloud-functions-for-firebase This changelist will reproduce the issue if you try to change to getDownloadURL or try to get an emulated storage url THIS IS NOT A FUNCTIONAL CHANGELIST.
Issue
The
put
andgetDownloadURL()
methods in the storage module works with Firebase but not with Firebase Emulator, specifically shown in the following snippet:The client has given permission to read and write any files and was connected to the emulator before the function calls.
My speculation is that
getDownloadURL()
fetches a signed url, while the emulator explicitly does not support generating a signed url (however it does support generating an unsigned one, i.e.publicUrl
, in the format of something likehttp://localhost:9091/foo.appspot.com/file.abc
).I am not sure about the ref being null. Had anybody encountered this issue before?
Thank you for taking the valuable time to read this. Please correct me if this is not an issue with react-native-firebase.
Project Files
Javascript
Click To Expand
package.json
:firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:AppDelegate.m
:Android
(Didn't try)
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:16.1.0
Firebase
module(s) you're using that has the issue:@react-native-firebase/storage
TypeScript
? Y 4.8.3React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: