Azure / Azure/static-web-apps

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

Open
#1,498 4 comments 5 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.