I am building a new site for a client. While developing its running on the Free plan and it just ran out of video streaming minutes. This now results in a GraphQL error when querying the “video” field: "Cannot return null for non-nullable field VideoFileField.video"
IMO this is a bad developer experience as it makes further development quite complicated. Sure, we can go ahead and remove all occurrences of video in queries, but then we have to remember to add them back etc.
IMO the whole query should not fail and error. You can just return “null” for the video field.
My query is like this:
fragment VideoFragment on UploadVideoField {
muxPlaybackId
title
width
height
blurUpThumb
}
fragment BlogPost on BlogPostRecord {
title
featuredVideo {
video {
... VideoFragment
}
}
}
What I have found:
The same query is possible when testing on the “Content Delivery API Playground” online.
It appears there is a difference in the schema though. See these two screenshots:
Playground:
Query with gql.tada
in VS Code:
The gql.tada
query says UploadVideoField is required (with the “!” mark) but the Playground does not.
My project is based on the “starter kit” here: GitHub - datocms/nextjs-starter-kit
Any suggestions?