Skip to content
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

feat(storage): make downloadURL available for file metadata (firestore/firebase v5) #487

Closed
nasimoyz opened this issue Jun 12, 2018 · 4 comments

Comments

@nasimoyz
Copy link

What is the current behavior?
Thanks for all your amazing work on this library and for quickly deploying the fix for file upload (for firebase v5)!

I was wondering about the best way to write the downloadURL to the File Metadata when working with the firebase v5 updates?

Currently the File Metadata is written before the downloadURL is retrieved (with the downloadURL retrieval occurring in uploadResultFromSnap).
I can write it to the File Metadata after the firebase.uploadFile promise resolves, only issue is then writing File Metadata will always incur a second network call.

On dependencies:

"firebase": "^5.0.4",
"react-redux-firebase": "^2.1.5",
@prescottprue
Copy link
Owner

prescottprue commented Jun 12, 2018

@nasimoyz Yup, no problem! Glad the issues were reported so quickly!

As for getting downloadURL with v5: this logic, which is new as of v2.1.5, gets the downloadURL. I'm glad you pointed this out because it seems that the promise is running on result of the meta set promise when it should go before it so that can be included in the meta (exactly as you are saying).

The change should be easy enough to make, but it would be nice to capture this functionality with a unit test as well while we are at it. Thanks for reporting.

@prescottprue prescottprue changed the title question(FileMetadata): Writing downloadURL to file metadata (firestore/firebase v5) feat(storage): writing downloadURL to file metadata (firestore/firebase v5) Aug 13, 2018
@prescottprue prescottprue changed the title feat(storage): writing downloadURL to file metadata (firestore/firebase v5) feat(storage): make downloadURL available for file metadata (firestore/firebase v5) Aug 13, 2018
@pranavpanchal
Copy link

pranavpanchal commented Aug 15, 2018

Hey, I am carrying over from where we last left off from this thread: #480

I am using an async action. The following is the code:

screen shot 2018-08-14 at 8 34 59 pm

The screenshot that I posted in the previous comment was from console logging the file that was uploaded to firebase storage.

console.log(uploadedFile.uploadTaskSnapshot.ref.getDownloadURL());

@prescottprue
Copy link
Owner

@pranavpanchal uploadedFile.uploadTaskSnapSHot.ref.getDownloadURL() is a promise, so you will want to make sure you await it.

jenphillips added a commit to jenphillips/react-redux-firebase that referenced this issue Sep 6, 2018
jenphillips added a commit to jenphillips/react-redux-firebase that referenced this issue Sep 6, 2018
jenphillips added a commit to jenphillips/react-redux-firebase that referenced this issue Sep 6, 2018
jenphillips added a commit to jenphillips/react-redux-firebase that referenced this issue Sep 7, 2018
prescottprue added a commit that referenced this issue Sep 10, 2018
…pierce42

#487 fix(storage): fix downloadURL error in file upload metadata
prescottprue added a commit that referenced this issue Sep 11, 2018
* fix(storage): uploadFile gets downloadURL before writing metadata - #487, #488
* fix(storage): add unit tests for `fileMetadataFactory` (config level) and `metadataFactory` (option for uploadFile) to confirm downloadURL is available before writing metadata - #487, #488
* fix(storage): fix downloadURL error in file upload metadata - @jpierce42
* fix(auth): `LOGOUT` action dispatch only include preserve parameter if provided in settings (not when undefined)
@prescottprue
Copy link
Owner

This was released in v2.2.0-alpha.2 with associated unit tests that confirm downloadURL is available within the metadataFactory and fileMetadataFactory before writing the metadata to RTDB/Firestore. Reach out if it isn't working as expected.

@prescottprue prescottprue mentioned this issue Oct 9, 2018
3 tasks
prescottprue added a commit that referenced this issue Nov 10, 2018
* fix(storage): uploadFile gets downloadURL before writing metadata - #487, #488
* fix(storage): add unit tests for `fileMetadataFactory` (config level) and `metadataFactory` (option for uploadFile) to confirm downloadURL is available before writing metadata - #487, #488
* fix(storage): fix downloadURL error in file upload metadata - @jpierce42
* fix(auth): `LOGOUT` action dispatch only include preserve parameter if provided in settings (not when undefined)
* fix(profile): profile update on login works with email login (used to require `createUser`) - #475
* feat(HOCs): optimize firestoreConnect unset / set listeners - @demoran23
* fix(HOCs): firestoreConnect no longer requires store.firebase (only attaches to props if available)
* fix(auth): move detaching of profile listeners before `signOut` within `logout` method to fix `permission_denied` errors - #494
* fix(enhancer): support config already existing on store - [132 of redux-firestore](prescottprue/redux-firestore#132)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants