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

ServiceBusMessageActions raises grpc exception after migrating to Isolated worker in net8.0 in servicebus trigger execution #2761

Open
christianroll opened this issue Oct 9, 2024 · 5 comments
Labels
extensions: service-bus Needs: Author Feedback no recent activity no-recent-activity potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug

Comments

@christianroll
Copy link

Description

Migrating to isolated worker in net8.0 using the library ServiceBusMessageActions doesn't work properly. I need to use DeadLetterMessageAsync but raises the following exception:

Exception while executing function: Functions.MessageBus_HandleSplashContractedCampaigns Result: Failure
Exception: System.InvalidOperationException: Unable to resolve service for type 'Microsoft.Azure.ServiceBus.Grpc.Settlement+SettlementClient' while attempting to activate 'Microsoft.Azure.Functions.Worker.ServiceBusMessageActionsConverter'.

My fsproj is as below using all latest version:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <AzureFunctionsVersion>v4</AzureFunctionsVersion>
        <OutputType>Exe</OutputType>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>
    <ItemGroup>
        <FrameworkReference Include="Microsoft.AspNetCore.App" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0-preview1" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0-preview2" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.22.0" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
        <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
        <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0-rc.1.24431.7" />
        <PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0-rc.1.24431.7" />
        <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.0.1" />
    </ItemGroup>
....

Migrating without usage of ServiceBusMessageActions is totally fine, the servicebus trigger works but has this limitation of not being able to use deadLetterMessageAsync...

I referenced this in this thread as well: #2102 (comment)

Steps to reproduce

Having a servicebus trigger in isolated worker in dotnet 8.0 referecing library ServiceBusMessageActions when it gets triggered it will raise grpc exception mentioned previously.

@christianroll christianroll added the potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug label Oct 9, 2024
@jviau
Copy link
Contributor

jviau commented Nov 13, 2024

@christianroll I see you are using preview packages. We recently release GA 2.0.0, can you try those? Additionally, can you verify source gen is running for your project? Source gen is crucial in emitting code which will hook up extension configuration calls. Without those calls service bus will not register its services and lead to issues like this.

@christianroll
Copy link
Author

christianroll commented Nov 14, 2024

@jviau I upgraded all the versions to latest 2.0.0 and I also forced to be false: <FunctionsEnableExecutorSourceGen>false</FunctionsEnableExecutorSourceGen> but no success, still getting this error:

Exception: Unable to resolve service for type 'Microsoft.Azure.ServiceBus.Grpc.Settlement+SettlementClient' while attempting to activate 'Microsoft.Azure.Functions.Worker.ServiceBusMessageActionsConverter'.

@jviau
Copy link
Contributor

jviau commented Nov 22, 2024

@christianroll FunctionsEnableExecutorSourceGen property should be unrelated to the source gen I am talking about. Can you see this comment and let me know if you see the GeneratedFunctionMetadataProvider.g.cs being generated?

@jviau jviau added extensions: service-bus bug Something isn't working potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug Needs: Author Feedback and removed potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug bug Something isn't working Needs: Attention 👋 labels Nov 27, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

If you are not the original author (christianroll) and believe this issue is not stale, please comment with /bot not-stale and I will not close it.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extensions: service-bus Needs: Author Feedback no recent activity no-recent-activity potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug
Projects
None yet
Development

No branches or pull requests

2 participants