data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

[Bug]: I encountered a bug while trying to add stored procedures with authenticated enabeld

Open Muhammed-Afifi opened this issue 3 months ago • 1 comments

What happened?

I encountered a bug while trying to add stored procedures to the database configuration file. I'm receiving the following error when authentication is enabled, but it works fine when switched to anonymous access.

Below is the configuration from the config file:

"AMS_SP_GetFinancialReport": {
  "source": {
    "type": "stored-procedure",
    "object": "[dbo].[GetFinancialReport]",
    "parameters": {

      "Checkin": "2025-09-01",
      "Checkout": "2025-09-30",
      "ContractEnd": "null",
      "ContractStart": "null",
      "contractStatus": "0",
      "noOfRows": "100"
    }
  },
  "graphql": {
    "operation": "query"
  },
  "permissions": [
    {
      "role": "authenticated",
      "actions": [
        "execute"
      ]
    }
  ]
}
Image

Version

"version": "1.5.56"

What database are you using?

Azure SQL

What hosting model are you using?

Container Apps

Which API approach are you accessing DAB through?

GraphQL

Relevant log output

2025-10-16T21:31:10.4450061Z stdout F       System.ObjectDisposedException: Cannot access a disposed object.
2025-10-16T21:31:10.4450083Z stdout F       Object name: 'JsonDocument'.
2025-10-16T21:31:10.4450105Z stdout F          at System.Text.Json.ThrowHelper.ThrowObjectDisposedException_JsonDocument()
2025-10-16T21:31:10.4450182Z stdout F          at Azure.DataApiBuilder.Service.Services.ExecutionHelper.TryGetPropertyFromParent(IResolverContext context, JsonElement& propertyValue) in /_/src/Core/Services/ExecutionHelper.cs:line 331
2025-10-16T21:31:10.4450212Z stdout F          at Azure.DataApiBuilder.Service.Services.ExecutionHelper.ExecuteLeafField(IResolverContext context) in /_/src/Core/Services/ExecutionHelper.cs:line 182
2025-10-16T21:31:10.4450241Z stdout F          at HotChocolate.Resolvers.FieldResolverDelegates.<>c__DisplayClass0_0.<.ctor>b__0(IResolverContext context)
2025-10-16T21:31:10.4450273Z stdout F          at HotChocolate.Types.Helpers.FieldMiddlewareCompiler.<>c__DisplayClass9_0.<<CreateResolverMiddleware>b__0>d.MoveNext()
2025-10-16T21:31:10.4450296Z stdout F       --- End of stack trace from previous location ---
2025-10-16T21:31:10.4450317Z stdout F          at HotChocolate.Authorization.AuthorizeMiddleware.InvokeAsync(IMiddlewareContext context)
2025-10-16T21:31:10.4450339Z stdout F          at HotChocolate.Authorization.AuthorizeDirectiveType.<>c__DisplayClass3_0.<<CreateMiddleware>b__1>d.MoveNext()
2025-10-16T21:31:10.4450360Z stdout F       --- End of stack trace from previous location ---
2025-10-16T21:31:10.4450432Z stdout F          at HotChocolate.Execution.Processing.Tasks.ResolverTask.ExecuteResolverPipelineAsync(CancellationToken cancellationToken)
2025-10-16T21:31:10.4450460Z stdout F          at HotChocolate.Execution.Processing.Tasks.ResolverTask.TryExecuteAsync(CancellationToken cancellationToken)

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

Muhammed-Afifi avatar Oct 16 '25 21:10 Muhammed-Afifi

It has been some time since I submitted the ticket, and I have not yet received a response. I would appreciate any updates you can provide about the status of my inquiry or resolution for the mentioned issue.

Muhammed-Afifi avatar Nov 03 '25 08:11 Muhammed-Afifi

I hit this today as well

simonsabin avatar Dec 17 '25 08:12 simonsabin

Is this duplicate of https://github.com/Azure/data-api-builder/issues/2910

simonsabin avatar Dec 17 '25 08:12 simonsabin

Looks like duplicate of https://github.com/Azure/data-api-builder/issues/2858 thats been fixed but not released

simonsabin avatar Dec 17 '25 09:12 simonsabin