Title: FIREBASE_STORAGE_EMULATOR_HOST Environment Variable does not work with Admin SDK · Issue #874 · firebase/firebase-admin-java · GitHub
Open Graph Title: FIREBASE_STORAGE_EMULATOR_HOST Environment Variable does not work with Admin SDK · Issue #874 · firebase/firebase-admin-java
X Title: FIREBASE_STORAGE_EMULATOR_HOST Environment Variable does not work with Admin SDK · Issue #874 · firebase/firebase-admin-java
Description: 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:9...
Open Graph Description: 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 "FIREBA...
X Description: 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 "F...
Opengraph URL: https://github.com/firebase/firebase-admin-java/issues/874
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"FIREBASE_STORAGE_EMULATOR_HOST Environment Variable does not work with Admin SDK","articleBody":"#### My environment:\r\n\r\n * Operating System version: Mac OS Sonoma 14.0 (23A344)\r\n * Firebase Admin SDK version: 9.2.0\r\n * Firebase Product: Storage Emulator\r\n\r\n#### The problem:\r\n\r\nWhen 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.\r\n\r\nOther 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.\r\n\r\nI 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. \r\n\r\nAs see here, this was previously an issue filed for the Firebase Admin SDKin the GO Repository for the Admin SDK ([see here)](https://github.com/firebase/firebase-admin-go/issues/520) and was fixed here [(see here)](https://github.com/firebase/firebase-admin-node/pull/1175) and has been since claimed to be fixed and the logic used in the Node Admin SDK project will be implemented.\r\n\r\nThe 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.\r\n\r\nDocumentation on the Firebase Admin SDK [docs](https://firebase.google.com/docs/emulator-suite/connect_storage) is also incorrect if this is the case. \r\n\r\n\u003cimg width=\"958\" alt=\"Screenshot 2023-11-03 at 5 32 06 PM\" src=\"https://github.com/firebase/firebase-admin-java/assets/56804058/05cc36ce-9d37-43f3-9002-be18e492c9de\"\u003e\r\n\r\n\r\n#### Steps to reproduce:\r\n\r\nSet 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)\r\n\r\nUse the Java Admin SDK to try and make a call like normal.\r\n\r\nSee it fail and use the production Cloud Storage instance.\r\n\r\n#### Relevant Code:\r\n\r\nEnvironment Variable Set via Intellij Run Configuration\r\n\r\n\u003cimg width=\"681\" alt=\"Screenshot 2023-11-03 at 5 30 56 PM\" src=\"https://github.com/firebase/firebase-admin-java/assets/56804058/a44f53b0-ee73-4bfc-95d1-4aa1415d4d06\"\u003e\r\n\r\n\r\n\r\n\r\n \r\n InputStream input = this.getClass().getResourceAsStream(\"/service-account.json\");\r\n assert input != null;\r\n GoogleCredentials googleCredentials = GoogleCredentials.fromStream(input);\r\n\r\n\r\n FirebaseOptions options = FirebaseOptions.builder()\r\n .setCredentials(googleCredentials)\r\n .setProjectId(\"project-id\")\r\n .setDatabaseUrl(\"https://project-id-default-rtdb.firebaseio.com\")\r\n .setStorageBucket(\"project-id.appspot.com\")\r\n .build();\r\n\r\n\r\n FirebaseApp.initializeApp(options);\r\n\r\n InputStream fileInput = this.getClass().getResourceAsStream(\"/someFile.anyExtension\");\r\n Bucket bucket = StorageClient.getInstance().bucket();\r\n bucket.create(\"someFile.anyExtension\", fileInput, \"application/anyExtension\");\r\n \r\n\r\n","author":{"url":"https://github.com/tylerfrydenlund","@type":"Person","name":"tylerfrydenlund"},"datePublished":"2023-11-03T23:35:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/874/firebase-admin-java/issues/874"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:adcb0262-42f7-db4f-e438-1ef6604d5e6c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9AE8:786AF:CF7105:1101595:698EC2A3 |
| html-safe-nonce | 51ce31e7e959c5e7a5a8c7656f29cec5afbb0e30aff0f6b3355abf771281f592 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QUU4Ojc4NkFGOkNGNzEwNToxMTAxNTk1OjY5OEVDMkEzIiwidmlzaXRvcl9pZCI6IjY3NjgzMjQ5NTc5MjU0NTg1OTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 042702422aeeb9a1bab0cdba490b88fc12c9116be4a53592f6615405b23bf5f5 |
| hovercard-subject-tag | issue:1977050461 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/firebase/firebase-admin-java/874/issue_layout |
| twitter:image | https://opengraph.githubassets.com/780cfe16c2f916533cad728724b804852cd92351779a39b8ee6534d2472a48e8/firebase/firebase-admin-java/issues/874 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/780cfe16c2f916533cad728724b804852cd92351779a39b8ee6534d2472a48e8/firebase/firebase-admin-java/issues/874 |
| og:image:alt | 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 "FIREBA... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tylerfrydenlund |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| go-import | github.com/firebase/firebase-admin-java git https://github.com/firebase/firebase-admin-java.git |
| octolytics-dimension-user_id | 1335026 |
| octolytics-dimension-user_login | firebase |
| octolytics-dimension-repository_id | 84979119 |
| octolytics-dimension-repository_nwo | firebase/firebase-admin-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 84979119 |
| octolytics-dimension-repository_network_root_nwo | firebase/firebase-admin-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6b91a7e6e46287d26887e3fb7a4161657bab8f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width