An Azure service that provides an event-driven serverless compute platform.
Hi @Neščivera Ján (ERNI),
Thanks for reaching out to Microsoft Q&A.
Your timeouts are happening after your code finishes because the SendGrid output binding executes after the return statement. In Azure Functions, output bindings execute after your function code returns. So even though your log appears just before return mail;, the SendGrid binding is still making the HTTP call to SendGrid.
On a Consumption plan, this call can occasionally hang due to limited outbound SNAT ports or transient network delays. The function invocation stays active while the binding runs, which explains why it eventually hits the 10-minute timeout.
Diagnosing this is difficult because the SendGrid output binding does not expose HTTP logs or errors, so Application Insights only shows the function timing out.
Solution:
The reliable solution is to stop using the output binding and call the SendGrid SDK directly using await sgMail.send(mail), which gives full control, proper error handling, logging, and avoids these hidden binding delays.
Hope this helps!
If the resolution was helpful, kindly take a moment to click on
and click on Yes for was this answer helpful. And, if you have any further query do let us know.