Skip to content

Can't use graphql in onCreateNode #3121

@MrToph

Description

@MrToph

Hi,
I'm trying to make a graphql query in onCreateNode in gatsby-node.js, but graphql is undefined.
It seems like it's not passed to this function.

exports.onCreateNode = ({
  graphql,
  node,
  boundActionCreators,
  getNode,
}) => {
  console.log(graphql)
}

It works on exports.createPages, so I expected it to also work here. (The documentation also doesn't give much info on what arguments are available for the gatsby-node functions.)

Is there a reason why I cannot use graphql in this function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions