firebase / firebase-admin-node

Firebase Admin Node.js SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
1.63k stars 371 forks source link

Cannot call `getSignedUrl` when using authorized_user default credentials locally #2413

Open Derrreks opened 11 months ago

Derrreks commented 11 months ago

[READ] Step 1: Are you in the right place?

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

I'm initializing like:

export const admin = firebaseAdmin.initializeApp({
  credential: firebaseAdmin.credential.applicationDefault(),
  ...

but when I do that am unable to call Bucket.file().getSignedUrl() with the error:

Error: Cannot sign data without `client_email`

Looking into my local Firebase credentials, I notice there is no client_email there, but there is when using service accounts. I've found some issues around that seem to say this isn't possible with a personal service account (example).

If that's true, is it not possible at all to use my personal service account to work with files? Or is there a workaround that will enable this to work?

google-oss-bot commented 11 months ago

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

ottob commented 8 months ago

We have the same issue. It would be great to see a proper solution to this.

As a workaround we made a special cloud function (that is always running in the cloud) that generates signed urls that we call instead of the normal getSignedUrl functions when running in the emulator.