Can you reproduce this problem at local development environment?
(You can run
lean up and debug cloud functions at http://localhost:3001)
If it is not reproducible at local development environment, and you are using a trial instance, this may be caused by sleeping:
A trial instances will start sleeping if no request is made in the past 30 minutes.
A sleeping instance will resume when a request comes in.
It may take 2 to 10 seconds for the instance to get back running and have the
request processed. The requests made after that will be responded
BTW, this is a preview of English documentation:
(This is just a preview. English documentation is not launched officially. So it may contain some errors.)