question

MartinMilesich-5818 avatar image
0 Votes"
MartinMilesich-5818 asked MartinMilesich-5818 answered

Custom handler Function not marking run as complete

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?


azure-functions
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MartinMilesich-5818 avatar image
0 Votes"
MartinMilesich-5818 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.