Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Hubs Webjobs extension 4.2.0 fails with V4 function #2072

Closed
nzthiago opened this issue Oct 21, 2021 · 12 comments
Closed

Event Hubs Webjobs extension 4.2.0 fails with V4 function #2072

nzthiago opened this issue Oct 21, 2021 · 12 comments
Assignees
Labels

Comments

@nzthiago
Copy link
Member

Function App name: tried locally only
Tools used: VS Code and Core Tools
New V4 app or existing V3 app migrated to V4: Existing V3 migrating to V4 - https://github.com/nzthiago/event-processing-spark

According to #1987 the Microsoft.Azure.WebJobs.Extensions.EventHubs package version 4.2.0 should work with Functions v4 for triggering and from.
VS Code Debugging and Func start works, but throws this exception when trying to read from Event Hubs with Microsoft.Azure.WebJobs.Extensions.EventHubs 4.2.0:

[2021-10-21T20:58:05.336Z] The listener for function 'EventHubTrigger1' was unable to start.
[2021-10-21T20:58:05.339Z] The listener for function 'EventHubTrigger1' was unable to start. Microsoft.Azure.EventHubs.Processor: Encountered error while fetching the list of EventHub PartitionIds. Microsoft.Azure.Amqp: Operation is not valid due to the current state of the object.

image

After updating Microsoft.Azure.WebJobs.Extensions.EventHubs to version 5.0.0-beta.7 and making all the code updates to use the new Event Hubs SDK type changes, it worked fine.

@fabiocav
Copy link
Member

@AnatoliB is this something you can assign on your side? Thanks!

@brettsam
Copy link
Member

@nzthiago -- do you have the full project file for this app?

@nzthiago
Copy link
Member Author

@nzthiago -- do you have the full project file for this app?

The project I was trying to bring up to V4 is the one I linked to in the issue description. The function project itself is in this subfolder: https://github.com/nzthiago/event-processing-spark/tree/master/src/eventstreamprocessing

@alrod
Copy link
Member

alrod commented Oct 25, 2021

@brettsam, I reproduced the issue:
Create in VS + EventHubTrigger V4 function app and run locally. Or run V4 function host locally pointed to EH trigger function app.
I can not reproduce it online.

The issue is fixed after updating EH sdk. I am trying to get green build for the PR:
Azure/azure-functions-eventhubs-extension#98

@nzthiago
Copy link
Member Author

@alrod would that mean customers upgrading from V3 to V4 would have to do what I did and change their existing Functions code to use the new EH SDK classes/methods/properties? Even getting the message body is different with the new EH SDK.

@alrod
Copy link
Member

alrod commented Oct 25, 2021

@nzthiago, the package I update is the latest Microsoft.Azure.EventHubs.Processor(3.0.0 -> 4.3.2). I did not update to newest Microsoft.Azure.EventHubs.Processor. So the customers do not need to update the code.

@nzthiago
Copy link
Member Author

nzthiago commented Oct 25, 2021

Ok thank you, that's great to hear @alrod - let me know if / when there's an update and I can re-test on my side with that sample I was using. It's likely we'll need to document/update the documentation of the minimum version of the EH WebJobs nuget that is required.

@paulbatum
Copy link
Member

@alrod what is the underlying problem? I am not sure I understand why updating from major version 3.x to 4.x fixes the issue?What changed in Functions V4 that breaks compatibility with eventhubs processor 3.x?

@alrod
Copy link
Member

alrod commented Oct 26, 2021

I created 2 console apps pointed to netcoreapp3.1 and net6.0. Both apps have the same code and are referenced to Microsoft.Azure.EventHubs.Processor 3.0.0(Microsoft.Azure.Amqp 2.3.7)

For net6.0 I got the same exception as for V4 FunctionApp:

System.InvalidOperationException: 'Operation is not valid due to the current state of the object.'
    Microsoft.Azure.Amqp.Transport.TransportStream.Flush()
    System.IO.Stream.FlushAsync.AnonymousMethod__37_0(object) in Stream.cs
    System.Threading.Tasks.Task.InnerInvoke() in Task.cs
    System.Threading.Tasks.Task..cctor.AnonymousMethod__271_0(object) in Task.cs
    System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, object) in ExecutionContext.cs
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in ExceptionDispatchInfo.cs

The issue was fixed in Microsoft.Azure.Amqp 2.4.6:
Azure/azure-amqp#165
Azure/azure-amqp@a31e622

V4 function app works with EH extension pointed to Microsoft.Azure.EventHubs.Processor 4.3.2(Microsoft.Azure.Amqp 2.4.11) or the explicit reference to Microsoft.Azure.Amqp 2.4.11.

@alrod
Copy link
Member

alrod commented Nov 15, 2021

This fix is merged

@nzthiago
Copy link
Member Author

@paulbatum - I think this means #1987 should update the Event Hubs one to 4.3.0

@paulbatum
Copy link
Member

@nzthiago done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants