Skip to content

[Bug]: Issue adding Stored Procedures (Azure Cosmos DB / NoSQL / GraphQL) #1915

@jacksorjacksor

Description

@jacksorjacksor

What happened?

Following the instructions here, we've run into issues registering a stored procedure with DAB.

Within Azure Cosmos DB, NoSQL, there's a container called "Persons"
Attached to the container is a Stored Process called "DefaultStoredProc"

We've the following command to register the Stored Proc:

dab add DefaultStoredProc --source Persons.DefaultStoredProc --source.type "stored-procedure" --source.params "searchType:s" --permissions "anonymous:execute" --rest.methods "get" --graphql.operation "query" -c "[locationOfConfigFile].json"

That command populates the config file with the below:

"DefaultStoredProc": {
      "source": {
        "object": "Persons.DefaultStoredProc",
        "type": "stored-procedure",
        "parameters": {
          "searchType": "s"
        }
      },
      "graphql": {
        "enabled": true,
        "operation": "query",
        "type": {
          "singular": "DefaultStoredProc",
          "plural": "DefaultStoredProcs"
        }
      },
      "rest": {
        "enabled": false,
        "methods": [
          "post"
        ]
      },
      "permissions": [
        {
          "role": "anonymous",
          "actions": [
            {
              "action": "execute"
            }
          ]
        }
      ]
    }

Nothing is created in the schema.gql file.

When we run this, using dab start (or swa start) we get the following error - System.Collections.Generic.KeyNotFoundException: The given key 'DefaultStoredProc' was not present in the dictionary.

Any and all advice greatly appreciated!

TY, Rich

Version

0.9.7

What database are you using?

CosmosDB NoSQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

GraphQL

Relevant log output

$ dab start -c .\staticwebapp.database.config.json

Information: Microsoft.DataApiBuilder 0.9.7+e560142426d1c080b9fd7b7fabff51a276f6bf61
Information: User provided config file: .\staticwebapp.database.config.json
Loading config file from .\staticwebapp.database.config.json.
Information: Loaded config file: .\staticwebapp.database.config.json
Information: Setting default minimum LogLevel: Error for Production mode.
Starting the runtime engine...
Loading config file from .\staticwebapp.database.config.json.
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[63]
      User profile is available. Using 'C:\Users\jacks\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
fail: Azure.DataApiBuilder.Service.Startup[0]
      Unable to complete runtime initialization. Refer to exception for error details.
      System.Collections.Generic.KeyNotFoundException: The given key 'DefaultStoredProc' was not present in the dictionary.
         at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.ValidateStoredProceduresInConfig(RuntimeConfig runtimeConfig, ISqlMetadataProvider sqlMetadataProvider)
         at Azure.DataApiBuilder.Service.Startup.PerformOnConfigChangeAsync(IApplicationBuilder app)
fail: Azure.DataApiBuilder.Service.Startup[0]
      Could not initialize the engine with the runtime config file: .\staticwebapp.database.config.json
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
Unable to launch the Data API builder engine.
Error: Failed to start the engine.

Code of Conduct

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcosmosnosqltriageissues to be triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions