Firebase Eventarc function not triggered

  Kiến thức lập trình

why is this not working? I can see the “Sending eventarc” message and no error in the Logs Explorer confirming that the function sending the Eventarc is called but I don’t see the message “Eventarc received” meaning that the eventarc function doesn’t seem to be called. Thanks!

const { onCustomEventPublished } = require("firebase-functions/v2/eventarc");
const {getEventarc} = require('firebase-admin/eventarc');

exports.onEventArcReceived = onCustomEventPublished(
'test.eventarctrigger',
(event) => {
    console.log("Eventarc received")
    const eventData = event.data;
    console.log(eventData)
    }
)
exports.testEventarc = onCall(
    {cors: ALLOWED_ORIGINS},
    (request) => {
        console.log("Sending eventarc")
        try{
            getEventarc().channel().publish({
                type: 'test.eventarctrigger',
                data: {
                    message: 'Arc event Message'
                }
            });
        }catch(error){
            console.log("error ", error)
        }
    }
)

LEAVE A COMMENT