AMQP timeout error connecting to Azure Service Bus from Azure Functions

cloud azure

My requirement was to create an Azure Service Bus trigger for an Azure function. When a message get queued to a ASB topic, the function must process it. However, I was receiving an AMQP timeout error related to AMQP ports not being opened.

After a bit of googling, I found a fix that worked for me. Add the following to the host.json file:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      },
      "enableLiveMetricsFilters": true
    }
  },
  "extensions": {
    "serviceBus": {
      "transportType": "amqpWebSockets"
    }
  }
}

My demo was a success and I have now forwarded the problem to the amazing "infra guy" to investigate the problem deeper.