question

BrunoLucas-9843 avatar image
0 Votes"
BrunoLucas-9843 asked MayankBargali-MSFT commented

Issue debugin azure function (v3 core 3.1) with EventHubTrigger. Error "The listener for function 'TriggerBatch' was unable to start"

Hi,
Just created an azure function using dot net core 3 following this:
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs-trigger?tabs=csharp.

the http trigger works after I set it to use websockets but the hub trigger throws this error:

The listener for function 'TriggerBatch' was unable to start.
[2021-08-05T04:51:59.647Z] The listener for function 'TriggerBatch' was unable to start. Microsoft.Azure.EventHubs.Processor: Encountered error while fetching the list of EventHub PartitionIds. System.Private.CoreLib: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

The connection string is correct. any ideas? could be it also need somehow some setting to force running on websockets?

azure-functionsazure-event-hubs
· 7
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.

@BrunoLucas-9843 Can you confirm if you are using the connection string at the namespace level not at the event hub level and atleast have listen permission if you are using event hub trigger. If you are performing any manage operation then need manage access then you need to specify the manage permission. If you have configured the VNET then your function app and event hub namespace should be under the same VNET.

0 Votes 0 ·

I had the connection string at the event hub level. tried the name space level but got the same error

0 Votes 0 ·

@BrunoLucas-9843 Can you share your function app code and what bindings you have defined. If the error is observed locally while debugging then I will suggest you to verify if you are connected to VPN and disconnect it or try another network as this could be one of the reason for the error.

0 Votes 0 ·
Show more comments

1 Answer

MayankBargali-MSFT avatar image
1 Vote"
MayankBargali-MSFT answered MayankBargali-MSFT commented

@BrunoLucas-9843 When you use AmqpWebSockets then it creates a tunnel over TCP port 443 that is then equivalent to AMQP 5671 connections. The eventhub trigger uses the default port 5671/5672 and there is configuration for same at the function eventhun trigger end.
As you have already tested so looks like these ports might be blocked at your network causing the issue. You can use PortQry tool to query your eventhub namespace on these ports to confirm if these are blocked or not.

I don't see any issue with the default code/configuration and I have tested the same at my end.

· 2
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.

yes. I can confirm was something blocking it. it worked when i tried in a different machine. Thanks MayankBargali!

0 Votes 0 ·

@BrunoLucas-9843 Thanks for the confirmation. I have converted my comment to answer. Feel free to "Accept it as Answer" so that it can help others in the community looking for help on similar topics.

0 Votes 0 ·