You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the package.json change the serve script to npm run build && firebase emulators:start --only functions,storage,pubsub --inspect-functions. Then
Call npm run serve
Upload any file to the storage emulator using the emulator ui
Observe
[REQUIRED] Expected behavior
When uploading the file what should happen is:
The storage function gets called
It prints OBJECT WRITTEN and the storage object
It publishes a pubsub message
The pubsub function gets called
It prints GOT MESSAGE and the message
[REQUIRED] Actual behavior
The storage function gets called
It prints OBJECT WRITTEN and the storage object
It publishes a pubsub message
The storage function gets called again
It prints OBJECT WRITTEN and the pubsub message
Since it publishes another pubsub message, the function gets called in an infinite loop
kilian@Kilians-MacBook-Pro functions % npm run serve
> serve
> npm run build && firebase emulators:start --only functions,storage,pubsub --inspect-functions
> build
> tsc
i emulators: Starting emulators: functions, pubsub, storage
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project at-development-302017. This may result in unexpected behavior.
⚠ functions: You are running the functions emulator in debug mode (port=9229). This means that functions will execute in sequence rather than in parallel.
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting
✔ functions: Using node@16 from host.
⚠ functions: Your GOOGLE_APPLICATION_CREDENTIALS environment variable points to /Users/kilian/.config/gcloud/application_default_credentials.json. Non-emulated services will access production using these credentials. Be careful!
i pubsub: Pub/Sub Emulator logging to pubsub-debug.log
i ui: Emulator UI logging to ui-debug.log
i functions: Watching "/Users/kilian/Desktop/test/functions" for Cloud Functions...
✔ functions[us-central1-onFile]: storage function initialized.
✔ functions[us-central1-onMessage]: pubsub function initialized.
┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://localhost:8002 │
└─────────────────────────────────────────────────────────────┘
┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├───────────┼────────────────┼─────────────────────────────────┤
│ Functions │ localhost:5002 │ http://localhost:8002/functions │
├───────────┼────────────────┼─────────────────────────────────┤
│ Pub/Sub │ localhost:8085 │ n/a │
├───────────┼────────────────┼─────────────────────────────────┤
│ Storage │ localhost:9199 │ http://localhost:8002/storage │
└───────────┴────────────────┴─────────────────────────────────┘
Emulator Hub running at localhost:4400
Other reserved ports: 4500
Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
> Debugger listening on ws://localhost:9229/bfcbb360-d440-4c40-b272-5e9c12326c97
> Debugger listening on ws://localhost:9229/bfcbb360-d440-4c40-b272-5e9c12326c97
> For help, see: https://nodejs.org/en/docs/inspector
i functions: Beginning execution of "onFile"
> OBJECT WRITTEN {
> kind: '#storage#object',
> name: '2021-11-27T13:05:05.760Z.jpg',
> bucket: 'at-development-302017.appspot.com',
> generation: '1647003462436',
> metageneration: '1',
> contentType: 'image/jpeg',
> timeCreated: '2022-03-11T13:57:42.435Z',
> updated: '2022-03-11T13:57:42.445Z',
> storageClass: 'STANDARD',
> size: '719578',
> md5Hash: 'degsNKFq/wfjF/MGsWP9dQ==',
> etag: 'someETag',
> crc32c: '----Sw==',
> timeStorageClassUpdated: '2022-03-11T13:57:42.435Z',
> id: 'at-development-302017.appspot.com/2021-11-27T13:05:05.760Z.jpg/1647003462436',
> selfLink: 'http://localhost:9199/storage/v1/b/at-development-302017.appspot.com/o/2021-11-27T13%3A05%3A05.760Z.jpg',
> mediaLink: 'http://localhost:9199/download/storage/v1/b/at-development-302017.appspot.com/o/2021-11-27T13%3A05%3A05.760Z.jpg?generation=1647003462436&alt=media'
> }
> {"severity":"WARNING","message":"Function returned undefined, expected Promise or value"}
i functions: Finished "onFile" in ~1s
i functions: Beginning execution of "onFile"
i functions: Finished "onFile" in ~1s
> OBJECT WRITTEN {
> data: { type: 'Buffer', data: [ 116, 101, 115, 116 ] },
> attributes: {}
> }
> {"severity":"WARNING","message":"Function returned undefined, expected Promise or value"}
i functions: Beginning execution of "onFile"
i functions: Finished "onFile" in ~1s
> OBJECT WRITTEN {
> data: { type: 'Buffer', data: [ 116, 101, 115, 116 ] },
> attributes: {}
> }
> {"severity":"WARNING","message":"Function returned undefined, expected Promise or value"}
i functions: Beginning execution of "onFile"
i functions: Finished "onFile" in ~1s
> OBJECT WRITTEN {
> data: { type: 'Buffer', data: [ 116, 101, 115, 116 ] },
> attributes: {}
> }
> {"severity":"WARNING","message":"Function returned undefined, expected Promise or value"}
This only happens when using --inspect-functions, otherwise it works fine!
This looks like it is related to #4232, which was fixed in firebase-tools@10.2.2 . Could you update to the latest version and see if this still occurs?
[REQUIRED] Environment info
firebase-tools: 10.2.1
Platform: macOS
[REQUIRED] Test case
I created a blank new project using
firebase init
and activatedfunctions
,storage
andemulators (functions, storage, pubsub)
.I then created two functions:
[REQUIRED] Steps to reproduce
In the
package.json
change theserve
script tonpm run build && firebase emulators:start --only functions,storage,pubsub --inspect-functions
. Thennpm run serve
[REQUIRED] Expected behavior
When uploading the file what should happen is:
OBJECT WRITTEN
and the storage objectGOT MESSAGE
and the message[REQUIRED] Actual behavior
OBJECT WRITTEN
and the storage objectOBJECT WRITTEN
and the pubsub messageThis only happens when using
--inspect-functions
, otherwise it works fine!firebase-debug.log
pubsub-debug.log
ui-debug.log
The text was updated successfully, but these errors were encountered: