Skip to content

[Bug]: GraphQL returns 500 when entity fields array is defined in dab-config.json #3202

@DclearEE

Description

@DclearEE

What happened?

When adding the fields array (with name, description, and primary-key properties) to entities in dab-config.json, all GraphQL queries return HTTP 500 error.

REST endpoints continue to work normally. The GraphQL schema fails to initialize entirely — even { spools(first: 1) { items { spoolId } } } returns 500.

This was happening on the 1.7.86-rc, so I updated to 1.7.90 and it's still occurring.

To Reproduce:

  1. Add a fields array to any table entity in dab-config.json:
{
  "entities": {
    "Project": {
      "source": {
        "object": "dbo.Projects",
        "type": "table"
      },
      "fields": [
        { "name": "projectId", "description": "Primary key", "primary-key": true },
        { "name": "projectName", "description": "Display name of the project" }
      ],
      "graphql": {
        "enabled": true,
        "type": { "singular": "Project", "plural": "Projects" }
      },
      "permissions": [{ "role": "authenticated", "actions": [{ "action": "read" }] }]
    }
  }
}
  1. Start DAB and send any GraphQL query
  2. Observe: HTTP 500, No primary key defined and conventions couldn't locate a fallback
  3. Remove the fields array — GraphQL works again

The fields array is useful for providing field descriptions for the describe-entities tool. Currently, removing fields is the only workaround to restore GraphQL, which means losing those MCP field descriptions.

Version

1.7.90

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

Azure.DataApiBuilder.Service.Exceptions.DataApiBuilderException: No primary key defined and conventions couldn't locate a fallback
   at Azure.DataApiBuilder.Service.GraphQLBuilder.GraphQLUtils.FindPrimaryKeyFields(ObjectTypeDefinitionNode node, DatabaseType databaseType)
   at Azure.DataApiBuilder.Service.GraphQLBuilder.Queries.QueryBuilder.GenerateByPKQuery(...)
   at Azure.DataApiBuilder.Service.GraphQLBuilder.Queries.QueryBuilder.Build(...)

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageissues to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions