Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
318 stars 53 forks source link

Nested GraphQL queries now fails with The given key 'xxx' was not present in the dictionary." #1498

Open MrMossevig opened 1 week ago

MrMossevig commented 1 week ago

After SWA recently updated DAB, nested GraphQL queries towards CosmosDB stopped working. All queries fail with "The given key 'xxx' was not present in the dictionary.", where 'xxx' is the nested object.

It is also still working fine using the SWA emulator locally, but fails once deployed to SWA.

To Reproduce We have a model similar to the Series schema in the GraphQL documentation: https://learn.microsoft.com/en-us/azure/data-api-builder/reference-database-specific-features#schema-in-api-for-nosql

Our model looks like this:

type InverterData {
  Name: String
  Value: String
  Unit: String
}

type ErrorBody {
  error_data: [InverterData]
  error_id: String
  error_number: Int
  collection_time: String
  stamp_time: String
}

type InformationBody {
  collection_data: [InverterData]
  sn: String
  stamp_time: Int
  collection_time: Int
  stamp_hash: String
}

type Telemetry @model {
  id: ID
  partitionKey: String
  Body: InformationBody
  _ts: Int
}

type Historical @model {
  id: ID
  partitionKey: String
  Body: InformationBody
  _ts: Int
}

type Error @model {
  id: ID
  partitionKey: String
  Body: ErrorBody
  _ts: Int
}

When this is deployed to a server, any requests trying to retrieve anything (even without including the "Body") fails with:

{
    "errors": [
        {
            "message": "The given key 'InformationBody' was not present in the dictionary.",
            "locations": [
                {
                    "line": 2,
                    "column": 5
                }
            ],
            "path": [
                "telemetries"
            ]
        }
    ]
}

Expected behavior Previously this worked fine and we were able to retrieve data. It is also still working fine using the SWA emulator locally.

It is however not working fine once deployed.