πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

Error encountered when deploying GraphQL in Sanity.io

5 replies
Last updated: Jan 25, 2021
I've made a singleton page for landing page settings, and now I'm trying to get the different fields sorted by using collapsible objects. Works like a charm if I just run
sanity start
, but when I try to run
sanity graphql deploy
I get the following error:
Error: Encountered anonymous inline object "coverOptions" for field/type "LandingPage". To use this field with GraphQL you will need to create a top-level schema type for it. See <https://docs.sanity.io/help/schema-lift-anonymous-object-type>
I don't fully understand the help page, fairly new to this still, so figured I'd check here if anyone has got any tips on how to fix this?
Jan 25, 2021, 9:46 PM
I've tried making the object into it's own type, but I'm not sure how to import it to the singleton schema
Jan 25, 2021, 9:47 PM
Hi Per, as long as you add the new object type to your
schema.js
file, you should be able to include it in your singleton as a field of
type: 'coverOptions'
.
Jan 25, 2021, 9:49 PM
Hi Per, as long as you add the new object type to your
schema.js
file, you should be able to include it in your singleton as a field of
type: 'coverOptions'
.
Jan 25, 2021, 9:49 PM
I've tried making the object into it's own type, but I'm not sure how to import it to the singleton schema
Jan 25, 2021, 9:47 PM
Well shit that was the part I missed
Thanks a ton!
Jan 25, 2021, 9:58 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?