firebase / firebase-admin-go

Firebase Admin Go SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SDK doesn't honor FIREBASE_STORAGE_EMULATOR_HOST environment variable

abhis3 opened this issue · comments

Go Version: 1.19.2
Emulator Version: 11.16.0

Describe the problem

The GO Admin SDK doesn't honor the env var set through FIREBASE_STORAGE_EMULATOR_HOST. You can see in this code sample that we need to set STORAGE_EMULATOR_HOST as well for this to work, or else the code will still try and point to prod.

You can see that there is some logic in the Node Admin SDK to handle this case: https://github.com/firebase/firebase-admin-node/blob/f596f2ca0d624990b93c1164a83b056ac064d38d/src/storage/storage.ts#L48

Other users are running into this issue, see https://stackoverflow.com/questions/71561446/firebase-storage-emulator-ignored-by-go-admin-sdk

Relevant Code:

https://github.com/abhis3/firebase-go-admin-sdk-mvp/blob/main/hello.go#L35

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

Needs to be labeled with api:storage

Hi @abhis3 ! Thank you so much for reporting this issue. You are right, we need to map the firebase style env var to the cloud style env var. We can follow the same logic we used in the Node.js repo firebase/firebase-admin-node#1175

FYI: @christhompsongoogle