Why does my asynchronous code fail to run in Function Compute?

Updated at:
Copy as MD

Possible causes

When a function returns a response and no request is being executed, Function Compute freezes the function instance and suspends code execution. The suspended code does not resume until the instance is unfrozen when the next request arrives.

Solution

Add logic to wait for asynchronous code to finish before the function returns a response.