Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQLError: Runtime Object type "SanityImage" is not a possible type for "Image". when querying an array of images #187

Open
logansparlin opened this issue Oct 25, 2022 · 1 comment

Comments

@logansparlin
Copy link

After defining an Image interface:

interface Image implements Node {
      id: ID!
      alt: String
      _key: String
      gatsbyImageData: GatsbyImageData
      url: String
    }

and the SanityImageAsset type:

type SanityImageAsset implements Node & Image {
      id: ID
      alt: String @proxy(from: "altText")
      gatsbyImageData: GatsbyImageData
      url: String
    }

I'm able to type a single Image like image: Image @link(by: "id", from: "image.asset._ref"), however when I try and do the same for an array of images images: [Image] @link(by: "id", from: "images.asset._ref") I'm getting the error GraphQLError: Runtime Object type "SanityImage" is not a possible type for "Image".

@logansparlin
Copy link
Author

Since it's happening at runtime and only for an array of images, I'm not really sure what the issue is but seems like a bug with the generated graphql schema from gatsby-source-sanity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant