[gatsby-source-graphql] How to download images from remote schema?
tomsseisums opened this issue ยท 5 comments
Summary
I am looking for a way to download images so that Sharp could take over, and have been following this issue to do so: #2902 (comment)
Apparently, onCreateNode
doesn't give deep information when using gatsby-source-graphql
, since only the "root" node is created. Also, the setFieldsOnGraphQLNodeType
doesn't help.
The only relevant node being this:
onCreateNode
{ id: '0e63a2e0-c90e-55a2-995f-73b1a7959dd8',
typeName: '<Project>',
fieldName: '<project>',
parent: null,
children: [],
internal:
{ type: 'GraphQLSource',
contentDigest: 'f46f568173ddc3eb99427dad09a9c96d',
ignoreType: true,
owner: 'gatsby-source-graphql' } }
Where do I hook in to createRemoteFileNode
?
Relevant information
Environment (if relevant)
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.7.0 - /usr/local/bin/node
Yarn: 1.9.2 - /usr/local/bin/yarn
npm: 6.2.0 - /usr/local/bin/npm
Browsers:
Chrome: 69.0.3497.100
Safari: 12.0
npmPackages:
gatsby: ^2.0.6 => 2.0.6
gatsby-plugin-emotion: ^2.0.5 => 2.0.5
gatsby-plugin-manifest: ^2.0.2 => 2.0.2
gatsby-plugin-offline: ^2.0.5 => 2.0.5
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
gatsby-source-filesystem: ^2.0.1 => 2.0.1
gatsby-source-graphql: ^2.0.2 => 2.0.2
File contents (if changed)
gatsby-config.js
: N/A
package.json
: N/A
gatsby-node.js
:
exports.setFieldsOnGraphQLNodeType = ({ type }) => {
console.log('setFieldsOnGraphQLNodeType')
console.dir(type, { depth: null })
return
}
exports.onCreateNode = ({ node, actions, createNodeId }) => {
console.log('onCreateNode')
console.dir(node, { depth: null })
return
}
gatsby-browser.js
: N/A
gatsby-ssr.js
: N/A
Currently it's not possible to mix 3rd party schemas with goodies like sharp transformation from gatsby - we get 3rd party schema as-is. We do have plans to work on that - see gatsbyjs/rfcs#11 and issues linked there
Ouch, this hurts a lot. ๐ข
Great to hear there's future plans to add support for mixing 3rd party schemas. Definitely seems like it's better to write a custom source if you need these sorts of integration in the meantime.
We have a CMS with a GraphQL endpoint. I was beyond happy to see that you could use the GraphQL endpoint directly with v2 instead of querying all data manually in gatsby-node and then requerying that data within the pages and components.
It's unfortunate to see that this way you can't use the transformer plugins. I'm gonna check out gatsbyjs/rfcs#11 and see if I can contribute to support plugins.
Great solution here
@joltmode tears no more
https://dev.to/nevernull/gatsby-with-wpgraphql-acf-and-gatbsy-image-72m