How to catch error "Task timed out after 10.01 seconds"

My function https://reverent-villani-1a164a.netlify.app/api/resi/0202682000380932/jne
sometimes get time out.

My question is how to catch this and not showing the error

Thank you.

You’d need to implement a timer within your function to abort before 10 seconds and do cleanup. I’d suggest 9s, since 10s is the absolute end so setting it “at” 10 seconds would mean the function is already shutting down by the time your timer activates.