hasura / hasura/graphql-engine
Database Query Error, Cannot Cast Type Record during mutation has randomly stopped working in Hasura Cloud w/2.0.9 latest update
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: 2.0.9-cloud.1
### Environment
Cloud
### What is the expected behaviour?
Mutation works just fine
### Keywords
insert, update, mutation, failure
### What is the current behaviour?
A mutation that we have been running in production for ~ 1 year now has just stopped working with the following errors:
"Database query error",
"cannot cast type record to \"Comments\""
Here is the mutation:
```
mutation CREATE_COMMENT($comment: Comments_insert_input!) {
insert_Comments_one(object: $comment) {
id
text
Identity {
id
}
Author {
id
}
}
}
```
With the following variables:
```
{
"comment": {
"identity_id": 670,
"author_id": 670,
"text": "
test
","type": "NOTE",
"company_id": 7
}
}
```
When we remove the joins "Identity" and "Author" then the mutation functions normal
```
mutation CREATE_COMMENT($comment: Comments_insert_input!) {
insert_Comments_one(object: $comment) {
id
text
# Identity {
# id
# }
# Author {
# id
# }
}
}
```
### How to reproduce the issue?
Run the mutation shown above
We are a paid, production Hasura Cloud customer, this was introduced without our consent during an upgrade we did not consent to or opt into. Hasura cannot and must immediately stop messing with production customers' code levels without giving us the chance to test the changes on our workloads & configurations no matter how small the change (the root cause here of the production issue isn't this bug as much as untested code being pushed into our production instance without notification or opt-in or time to test it! I've opened a bug against that behavior now here as this is the SECOND time in a month or so this has been done to us by a Hasura-introduced bug!). That is https://github.com/hasura/graphql-engine/issues/7568
This issue feels familiar to https://github.com/hasura/graphql-engine/issues/7557 but in our mutation here we are not referencing any generated fields or computed fields, so it may not be the exact same pathology.
This has actively taken down a major part of our production workload, yet we have had NO meaningful response to tickets from our paid support contact, which is frankly unacceptable for a paid production offering who has auto-upgraded the instance, provides NO facility to down grade, and has introduced their OWN bugs.
Hasura Cloud is quickly becoming the worst decision we have made lately, please help me change my mind about that.
Contributor guide
Research direction
Start by reproducing the shown CREATE_COMMENT mutation against the reported Hasura Cloud 2.0.9 environment, comparing it with the version that omits the Identity and Author joins. Trace the mutation's generated database query and verify that the complete mutation succeeds with both relationships while preserving the returned fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql
- Domain
- api, backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100