The issue was function host cannot handle empty response from handler. Sending just response code is not enough. I had to set content type to "application/json" and body to "{}" for function host to mark the execution as successful.
Custom handler Function not marking run as complete
Martin Milesich
166
Reputation points
I have a function written in golang and my only trigger is Service Bus w/o any output binding. The handler returns 200 back to the function host but it will not mark the run as complete and instead it will timeout eventually.
After the handler returns 200 back to the host I see a few of these in the log:
"time": "2021-11-03T17:06:27Z", 'message':'Response code while pinging uri http://127.0.0.1:40249/ is NotFound','category':'Microsoft.Azure.WebJobs.Script.Workers.Http.DefaultHttpWorkerService'
"time": "2021-11-03T17:06:27Z", 'message':'Executing HttpStatusCodeResult, setting HTTP status code 200','category':'Microsoft.AspNetCore.Mvc.StatusCodeResult'
"time": "2021-11-03T17:06:36Z", 'message':'Response code while pinging uri http://127.0.0.1:40249/ is NotFound','category':'Microsoft.Azure.WebJobs.Script.Workers.Http.DefaultHttpWorkerService'
"time": "2021-11-03T17:06:37Z", 'message':'Executing HttpStatusCodeResult, setting HTTP status code 200','category':'Microsoft.AspNetCore.Mvc.StatusCodeResult'
host.json
{
"version": "2.0",
"logging": {
"logLevel": {
"default": "Trace"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
},
"customHandler": {
"description": {
"defaultExecutablePath": "handler",
"workingDirectory": "",
"arguments": []
}
}
}
function.json
{
"bindings": [
{
"name": "queueItem",
"type": "serviceBusTrigger",
"direction": "in",
"queueName": "queue",
"connection": "xxx_SERVICEBUS"
}
]
}
How can I make the function complete successfully?