-
Notifications
You must be signed in to change notification settings - Fork 959
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
Feature Request: support CORS config in Storage emulator #5881
Comments
This line makes me think it's a DNS resolution issue:
Try using 127.0.0.1 instead of localhost and let me know if that resolves this issue on 18 |
Changed localhost to IP address 127.0.0.1 in my .env file. Now get this error on both versions of node: [1] ApiError: Not Implemented |
My firebase.json file:
storage.rules:
Command to start emulators:
|
Hi @andriibulbuk. Let me know if I may have misunderstood anything. From what I can tell you are running an Express app which uses the "firebase-admin" sdk to access the Firebase Storage Emulator. I tried to reproduce the behavior you mentioned but I did not encounter any issues when accessing files in the Firebase Storage Emulator using my Express app. I’m not sure if I may be missing something, but would it be okay if you could provide Also, I noticed you mentioned you were using |
It seems that an error happens when I try to configure cors for my bucket:
Without this configuration I can connect to the Firebase storage emulator |
Based on our docs, it looks like Cloud Storage for Firebase emulator currently does not support bucket-level CORS configuration. This may be the reason why you’re encountering the error when using
That said, I’ll be marking this issue as a feature request. Please note that we would not be able to provide a timeline as to when this would be implemented. I can only suggest checking this ticket for updates. |
Hey @andriibulbuk. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
same issue here, I think it's related to #4741 what appears to be a solution: firebase/firebase-admin-node#2084 (comment) |
Thanks for the inputs @dr-aiuta. Seems like the comment in firebase/firebase-admin-node#2084 (comment) resolves the dns related issue when using Node 18. However, even after replacing If in case you are still encountering an issue connecting to the Cloud Storage for Firebase emulator, and you’re not using |
[REQUIRED] Environment info
11.23.0
firebase-tools:
macOS
Platform:
[REQUIRED] Test case
I have two separate repositories with my node.js API and my Firebase repository. My API runnings outside of Firebase environment and I use the "firebase-admin" package. So first of all I start my firebase emulator services (ui, functions, firestore, storage). And I can access my "olympus-grip-dev.appspot.com" bucket from emulator UI, but when I try to connect to firebase storage from my api I get APIError: NotImplemented on node v16.17.0 and FetchError on node v18.14.2. I can access firestore emulator and cloud functions emulator works well with my api.
[REQUIRED] Steps to reproduce
admin.initializeApp({
projectId: GCLOUD_PROJECT
});
envs:
APP_PORT=3000
INSTANCE_APP_PORT=3000
GCLOUD_PROJECT=olympus-grip-dev
GOOGLE_APPLICATION_CREDENTIALS=/Users/andriibulbuk/Projects/OG-admin-api/src/common/configs/google-application-credentials.json
FIRESTORE_EMULATOR_HOST=localhost:8080
FIREBASE_STORAGE_EMULATOR_HOST=localhost:9199
[REQUIRED] Expected behavior
My API successfully connects to the firebase storage emulator
[REQUIRED] Actual behavior
Get such errors when try to connect from api to firebase storage:
v16.17.0:
1] ApiError: Not Implemented
[1] at new ApiError (/Users/andriibulbuk/Projects/OG-admin-api/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:79:15)
[1] at Util.parseHttpRespMessage (/Users/andriibulbuk/Projects/OG-admin-api/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:181:41)
[1] at Util.handleResp (/Users/andriibulbuk/Projects/OG-admin-api/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:155:76)
[1] at /Users/andriibulbuk/Projects/OG-admin-api/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:537:22
[1] at onResponse (/Users/andriibulbuk/Projects/OG-admin-api/node_modules/retry-request/index.js:240:7)
[1] at /Users/andriibulbuk/Projects/OG-admin-api/node_modules/teeny-request/build/src/index.js:226:13
[1] at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[1] code: 501...
v18.14.2
[1] FetchError: request to http://localhost:9199/b/olympus-grip-dev.appspot.com? failed, reason: connect ECONNREFUSED ::1:9199
[1] at ClientRequest. (/Users/andriibulbuk/Projects/OG-admin-api/node_modules/node-fetch/lib/index.js:1505:11)
[1] at ClientRequest.emit (node:events:513:28)
[1] at Socket.socketErrorListener (node:_http_client:502:9)
[1] at Socket.emit (node:events:513:28)
[1] at emitErrorNT (node:internal/streams/destroy:151:8)
[1] at emitErrorCloseNT (node:internal/streams/destroy:116:3)
[1] at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
[1] type: 'system',
[1] errno: 'ECONNREFUSED',
[1] code: 'ECONNREFUSED'
[1] }
[2023-05-23T11:50:04.325Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"storage"},"message":"Ignoring unsupported arg: port"}}
[2023-05-23T11:50:04.748Z] Temp file directory for storage emulator: /var/folders/b6/5ymqsg8934q7h6ttvcwgb8780000gn/T/firebase/storage/blobs {"metadata":{"emulator":{"name":"storage"},"message":"Temp file directory for storage emulator: /var/folders/b6/5ymqsg8934q7h6ttvcwgb8780000gn/T/firebase/storage/blobs"}}
The text was updated successfully, but these errors were encountered: