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

[BUG] SignalRTrigger CosmosDB input binding - InvocationContext.UserId #35762

Closed
tonyhallett opened this issue Apr 24, 2023 · 1 comment
Closed
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Functions needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@tonyhallett
Copy link

Library name and version

Microsoft.Azure.WebJobs.Extensions.SignalRService ( 1.9.0 ), Microsoft.Azure.WebJobs.Extensions.CosmosDB ( 4.2.0), Microsoft.NET.Sdk.Functions ( 4.1.3)

Describe the bug

Given a generic ServerlessHub that successfully negotiates I have the following function invoked from the signalR client

        [FunctionName(nameof(InitialPlayerData))]
        public Task InitialPlayerData(
            [SignalRTrigger] InvocationContext invocationContext,
            [CosmosDB("Crib", "Players", Connection = "CosmosConnectionString", Id = "{UserId}", PartitionKey = "{UserId}")] Player player,
            ILogger logger)
        {
           .....

        }

image

Can I bind the UserId parameter ?

I checked with ChatGPT and it agreed that the CosmosDB attribute appeared correct.

If I change to using the CosmosClient directly the function is executed

        [FunctionName(nameof(InitialPlayerData))]
        async public Task InitialPlayerData(
            [SignalRTrigger] InvocationContext invocationContext,
            [CosmosDB(Connection = "CosmosConnectionString")] CosmosClient cosmosClient,
            ILogger logger)
        {  //.......

Expected behavior

Should bind.

Actual behavior

Does not bind.

Reproduction Steps

Not the easiest thing to reproduce given that requires an authentication service, a client app and azure configuration.

I can provide further details but I would just like to know if it is possible to bind to the UserId property.

[CosmosDB("Crib", "Players", Connection = "CosmosConnectionString", Id = "{UserId}", PartitionKey = "{UserId}")]

Environment

Azure Functions.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.CosmosDB" Version="4.2.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.9.0" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
  </ItemGroup>

Visual Studio 17.5.1

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Functions needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 24, 2023
@jsquire
Copy link
Member

jsquire commented Apr 24, 2023

This issue has been transferred to the repository where the Microsoft.Azure.WebJobs.Extensions.CosmosDB package is maintained as #843

@jsquire jsquire closed this as completed Apr 24, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jul 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Functions needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants