Skip to content

[gatsby-source-graphql] How to download images from remote schema? #8404

@tomsseisums

Description

@tomsseisums

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions