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

gatsby-transfomer-sharp adds childImageSharp to wrong types. #27924

Closed
andris-sevcenko opened this issue Nov 9, 2020 · 2 comments · Fixed by #27992
Closed

gatsby-transfomer-sharp adds childImageSharp to wrong types. #27924

andris-sevcenko opened this issue Nov 9, 2020 · 2 comments · Fixed by #27992
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@andris-sevcenko
Copy link

Description

During onCreateNode the plugin only checks whether the extension field exists and is populated with a supported extension, before adding the childImageSharp field to the node, and this behavior is not configurable.

In Craft CMS, Assets are content elements that describe a file, so it's perfectly normal for them to have a populated extension field, however, they are not files themselves. This leads to childImageSharp fields being created on them that always results in an error.

Steps to reproduce

Have an external data source and have at least one type that has the extension field populated with a valid image extension.

Run gatsby develop, open http://localhost:800/__graphql and query for the corresponding Gatsby node. Observe that a childImageSharp field is present.

You can use the following project to reproduce it: https://github.com/craftcms/starter-blog/blob/master/headless-front-end/gatsby/README.md, but it'll be a little bit involved.

Expected result

The childImageSharp field should not appear based on one field existing or not.

Actual result

It does appear.

@pieh
Copy link
Contributor

pieh commented Nov 12, 2020

Thanks for report - I opened #27992 that should remove childImageSharp from non-File types

@pieh pieh added status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: sharp and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Nov 12, 2020
@andris-sevcenko
Copy link
Author

Appreciate the speedy resolution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants