firebase / firebase/firebase-tools

Feature Request: support CORS config in Storage emulator

Open
#5,881 9 comments 0 reactions 1 assignee Assigned to @aalej View on GitHub
emulators: storage type: feature request
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [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

1. Run firebase emulators (ui, functions, firestore, storage)
2. Run express application:

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"}}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.