In Firebase I have installed extension Resize Images
which claims to send an event upon completion: firebase.extensions.storage-resize-images.v1.complete
I have created a function trigger to handle this event:
exports.onimageresized2 = onCustomEventPublished(
{
eventType: 'firebase.extensions.storage-resize-images.v1.complete',
channel: 'projects/perfect-stroke-project/locations/europe-west4/channels/firebase',
region: 'europe-west4',
},
async (event: unknown) => {
const item = {
name: 'Hello',
};
const swingRequestDocRef = await firestore.collection('tool_types').add(item);
console.log(swingRequestDocRef.id);
console.log('it works!', JSON.stringify(event));
info([{ message: 'Received image resize completed event', event: event }]);
write({ message: 'received', severity: 'WARNING' });
},
);
My firebase settings show: eur3 (europe-west)
My extension is set to: europe-west3
My extension is set to send Events to channel in europe-west4
I am expecting that the even will trigger the handling and thus a) show logs, b) create item in Firestore. However, neither of those happens. I try to use Logs Explorer
to search for any of the logs I have in my event handler, but none exist. In the meantime, I can confirm that extension is working and files get created, and I can see the logs for that extension.
How can I figure out what is wrong with the event and event handler?
I suspected there is something to do with the regions and it indeed seems so.
There is only 1 region that exists as an option on all items - firebase
, the extensions
, the functions
, eventarc
and the region is us-central1
So I created a new firebase, migrated the data, set everything to this one region and it worked.
I wish there was an error somewhere to let me know that instead of having to experiment and lose a few days, but I wasn't able to find out a meaningful debugging process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With