I’m currently developing an Express App using Firebase and Cloud Functions.
I’ve registered Webhooks in Shopify when an Order is Created and when its Paid in Order. Sometimes this can obviously be at the exact same time.
In Order to have an easy time Logging I’ve created a Singleton Logger that I can call from any Method by just importing the Static Logger.
My understanding of Express and Cloud Functions was that I’d have separate Loggers per Request. However, I have some Log objects that I set the Type OrderCreated that have messages that can only be logged in the OrderPaid Methods.
Has anyone got any Ideas why this behaviour could be happening and If I’m using singletons wrong If I require an Instance per Request?
I’m trying not to use instances that have to be parsed into every single method for ease of use.
Also, I’ve created some middleware to check if the request originated from my Store.
I’ll follow up with this with the images of my coding.
Rhys Werner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.