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-source-graphql] download images from remote schema using Gatsby v4 #34192

Closed
2 tasks done
jaredhill4 opened this issue Dec 3, 2021 · 4 comments · Fixed by #35105
Closed
2 tasks done

[gatsby-source-graphql] download images from remote schema using Gatsby v4 #34192

jaredhill4 opened this issue Dec 3, 2021 · 4 comments · Fixed by #35105
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. stale? Issue that may be closed soon due to the original author not responding any more. type: documentation An issue or pull request for improving or updating Gatsby's documentation

Comments

@jaredhill4
Copy link

jaredhill4 commented Dec 3, 2021

Preliminary Checks

Summary

When using the gatsby-source-graphql plugin, the previous recommended way to download images from a remote GraphQL schema was to create a custom resolver inside the createResolvers function. Here is the documentation for that way of doing it:

https://www.gatsbyjs.com/docs/how-to/plugins-and-themes/adding-gatsby-image-support/#add-the-resolver

However, according to the Gatsby v4 documentation and migration guide, generating file nodes inside createResolvers is no longer supported. See:

As far as I can tell, the gatsby-source-graphql does not explicitly generate nodes containing all the data necessary to generate a file node in the onCreateNode function (which would be the only way of doing here, since the consumer of the plugin is not in control of the sourceNodes function of the plugin).

All that said, neither the documentation for Gatsby v4 nor that for the plugin in question provide adequate information about how to generate file nodes for images when using this plugin.

Steps to Resolve this Issue

  1. Visit the documentation links above and read my description of the issue.
    ...
@jaredhill4 jaredhill4 added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Dec 3, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 3, 2021
@jaredhill4
Copy link
Author

Because of the issue stated above, I'm unable to use the gatsby-source-graphql plugin if I want to generate file nodes for use with gatsby-plugin-image.

@LekoArts LekoArts added good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jan 31, 2022
@LekoArts
Copy link
Contributor

Hi!

It is correct that with our changes in v4 the explanation in https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization/#extending-third-party-types isn't accurate anymore. For now you'll want to switch to https://github.com/gatsbyjs/gatsby-graphql-toolkit to create a proper source plugin if you need image support.

The documentation you linked to is not the same as the changes in v4. The section explains how to set up a resolver that uses data/URLs from CMS and is not downloading images itself. The image downloading piece is the problem here.

Two things that should be changed:

  1. Remove https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization/#extending-third-party-types completely
  2. Add a short note about https://github.com/gatsbyjs/gatsby-graphql-toolkit to https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v3-to-v4/#do-not-create-nodes-in-custom-resolvers section

@Emeka-Ugbanu-hub
Copy link

i would love to help with this

@github-actions
Copy link

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. stale? Issue that may be closed soon due to the original author not responding any more. type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants