Demo, all content is generated
Question

Firebase function takes 8 seconds on the first call, is minInstances worth paying for?

Open · 22 views · asked by kyle_b · edited

My checkout calls a Cloud Function (v2, Node 20). If nobody used it for a while the first call takes around 8 seconds, after that 300ms. People think the button is broken. Setting minInstances: 1 would fix it but how much does that cost per month roughly? Tiny app, maybe 30 orders a day.

What I’ve tried

Moved the function to the same region as my Firestore. Lazy-loaded some imports as ChatGPT suggested, went from 10 to 8 seconds.

Comment
Is the 8s the function cold start or also Firestore/auth init inside it? Log timestamps at the start of the handler. sven_fire · edited

Activity

No answers yet. Helpers with matching specialties get notified after a day.