I have a problem with firebase pubsub trigger - the function causes error in firebase-functions code because some param is undefined.
I published an issue infirebase-functions repo here but don't know it's a problem with firebase-functions or somewhere else...? It seems that the argument passed to the pubsub trigger is undefined instead of being an object with published message data.
I have a simple function using v2 pubsub trigger, which should capture published message and save it into firestore. The function looks like this:
const onProfileCreated = onMessagePublished(
TOPIC_NAME,
(event) => handleMessagePublished(event.data.message.json) // this function should just store message data in firestore
);
While working perfectly well in local development using firebase emulators, this function's code doesn't get executed when deployed because of an error in firebase-functions code:
TypeError: Cannot read properties of undefined (reading 'messageId')
at new Message (/workspace/node_modules/firebase-functions/lib/v2/providers/pubsub.js:65:31)
at func (/workspace/node_modules/firebase-functions/lib/v2/providers/pubsub.js:127:40)
I have a problem with firebase pubsub trigger - the function causes error in
firebase-functions
code because some param is undefined.I published an issue in
firebase-functions
repo here but don't know it's a problem withfirebase-functions
or somewhere else...? It seems that the argument passed to the pubsub trigger isundefined
instead of being an object with published message data.I have a simple function using
v2
pubsub trigger, which should capture published message and save it into firestore. The function looks like this:While working perfectly well in local development using firebase emulators, this function's code doesn't get executed when deployed because of an error in
firebase-functions
code: