FIREBASE_STORAGE_EMULATOR_HOST Environment Variable does not work with Admin SDK
@jonathanedey ya está trabajando en esto.
Desde el 14/2/2025.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
My environment:
- Operating System version: Mac OS Sonoma 14.0 (23A344)
- Firebase Admin SDK version: 9.2.0
- Firebase Product: Storage Emulator
The problem:
When setting the environment variable "FIREBASE_STORAGE_EMULATOR_HOST" to 127.0.0.1:9199 (the default Storage Emulator Port and IP) to use the Firebase Storage Emulator the Admin SDK does not detect this environment variable.
Other Environment variables such as "FIREBASE_DATABASE_EMULATOR_HOST" and "FIRESTORE_EMULATOR_HOST" do work perfectly fine and as expected. They make a connection to emulators on the device.
I have gone as far to test and see if this issue is persistent on other Admin SDK's such as the Node.Js SDK. It is NOT an issue that persists on the SDK for Node.js.
As see here, this was previously an issue filed for the Firebase Admin SDKin the GO Repository for the Admin SDK (see here) and was fixed here (see here) and has been since claimed to be fixed and the logic used in the Node Admin SDK project will be implemented.
The same issue previously on the Go Repo, appears to be present on the Admin Java SDK. Even using the "STORAGE_EMULATOR_HOST" environment variable as it was changed to in the GO repo, does not work.
Documentation on the Firebase Admin SDK docs is also incorrect if this is the case.
Steps to reproduce:
Set either environment variable "STORAGE_EMULATOR_HOST" or "FIREBASE_STORAGE_EMULATOR_HOST" to your Emulator host address and port (the default is 127.0.0.1:9199)
Use the Java Admin SDK to try and make a call like normal.
See it fail and use the production Cloud Storage instance.
Relevant Code:
Environment Variable Set via Intellij Run Configuration
InputStream input = this.getClass().getResourceAsStream("/service-account.json");
assert input != null;
GoogleCredentials googleCredentials = GoogleCredentials.fromStream(input);
FirebaseOptions options = FirebaseOptions.builder()
.setCredentials(googleCredentials)
.setProjectId("project-id")
.setDatabaseUrl("https://project-id-default-rtdb.firebaseio.com")
.setStorageBucket("project-id.appspot.com")
.build();
FirebaseApp.initializeApp(options);
InputStream fileInput = this.getClass().getResourceAsStream("/someFile.anyExtension");
Bucket bucket = StorageClient.getInstance().bucket();
bucket.create("someFile.anyExtension", fileInput, "application/anyExtension");
- Lenguaje dominante
- Java
- Estrellas
- 620
- Forks
- 305
- Merge medio
- 4 d 9 h
- PR fusionados (30 d)
- 4
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de firebase/firebase-admin-java
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
firebase/firebase-admin-java#1231 ·
-
api: core
firebase/firebase-admin-java#1198 · 3 comentarios · 1 asignado ·
-
[BUG] RemoteConfig unit tests fail in non-English (e.g., Korean) Locales due to Date Parsing Abiertoapi: remoteconfig
firebase/firebase-admin-java#1196 · 1 comentario · 2 asignados ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
firebase/firebase-admin-java#1192 · 3 comentarios ·
-
needs-triage type: feature request
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
firebase/firebase-admin-java#1149 · 1 comentario ·
Todos los issues de firebase/firebase-admin-java
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
FasterXML/jackson-databind#6229 ·