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

Firebase Storage getDownloadURL doesn't finish running #5628

Closed
ulbqb opened this issue Oct 16, 2021 · 7 comments · Fixed by #5703
Closed

Firebase Storage getDownloadURL doesn't finish running #5628

ulbqb opened this issue Oct 16, 2021 · 7 comments · Fixed by #5703

Comments

@ulbqb
Copy link

ulbqb commented Oct 16, 2021

[REQUIRED] Describe your environment

  • Operating System version: MacOS 11.6
  • Browser version: No Browser
  • Firebase SDK version: 9.1.3
  • Firebase Product:Storage
  • Nodejs version: 14.18.0

[REQUIRED] Describe the problem

When I try to get the Storage DownloadURL with Nodejs, the getDownloadURL function works fine, but Nodejs doesn't finish running.
firebase-js-sdk should support the Nodejs environment.
https://firebase.google.com/docs/web/environments-js-sdk

Steps to reproduce:

Run the following code in Nodejs (14.18.0).
In my environment, Download URL is output normally, but Nodejs execution does not finish.

Relevant Code:

'use strict'
const { initializeApp } = require('firebase/app')
const { getStorage, ref, getDownloadURL } = require('firebase/storage')

initializeApp(
  {
    apiKey: '',
    authDomain: '',
    projectId: '',
    storageBucket: '',
    messagingSenderId: '',
    appId: '',
    measurementId: ''
  }
)

!(async () => {
  const storage = getStorage()
  const pathReference = ref(storage, 'sample.txt')
  const url = await getDownloadURL(pathReference)
  console.log(url)
})()
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@ulbqb ulbqb changed the title Firebase Storage getDownloadURL dose not Firebase Storage getDownloadURL doesn't finish running Oct 16, 2021
@jbalidiong
Copy link
Contributor

Hi @ulbqb, thanks for reporting this behavior. I tried following the steps you've provided to replicate the issue, however, I was able to get the download url. If I can replicate the issue, I can have a better look into it. Please share a minimal, but complete sample of a project that I can run locally.

@ulbqb
Copy link
Author

ulbqb commented Oct 21, 2021

Hi @jbalidiong, thanks for reply. I upload minimal project to https://github.com/ulbqb/firebase-js-sdk-issue-5628.
Result in my environment:

$ time npm run start

> [email protected] start /Users/ulbqb/firebase-js-sdk-issue-5628
> node index.js

https://firebasestorage.googleapis.com/v0/b/sample.appspot.com/o/sample.jpeg?alt=media&token=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

real    2m0.716s
user    0m0.581s
sys     0m0.142s
$ 

The problem is that the Download URL is printed correctly immediately, but the process doesn't finish until I wait a few minutes after it's printed.

@jbalidiong
Copy link
Contributor

Thanks for the minimal repro. I was able to reproduce the behavior now. Let me check what we can do for this issue or bring someone here that can provide more context about it. I’ll update this thread if I have any information to share.

@schmidt-sebastian
Copy link
Contributor

Does the issue still persist even you delete the Firebase app? This should stop all background activity.

https://firebase.google.com/docs/reference/js/app.md#deleteapp

@ulbqb
Copy link
Author

ulbqb commented Oct 22, 2021

I tried deleteApp function but it didn't solve the problem.
source: https://github.com/ulbqb/firebase-js-sdk-issue-5628/blob/delete_app/index.js

@jbalidiong jbalidiong added the bug label Oct 26, 2021
@LeMimit
Copy link

LeMimit commented Nov 2, 2021

Hello !

I see the same problem with the functions of storage library called with mocha to test the security rules (@firebase/rules-unit-testing).

I tested the function listAll and deleteObject. Same problem with both.
I have to wait around 2 minutes after the test finishes to see the process finish.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants