AndreasFaust / gatsby-source-custom-api

Source data from any API and transform it to (File-)Nodes.
52 stars 25 forks source link

auth is not defined #31

Closed a-rbsn closed 3 years ago

a-rbsn commented 3 years ago

I thought auth was optional but I appear to be getting an error:

success createSchemaCustomization - 0.006s

 ERROR #11330  PLUGIN

"gatsby-source-custom-api" threw an error while running the sourceNodes lifecycle:

auth is not defined

  45 |
  46 |   // load images or default-dummy-image
> 47 |   entities = await loadImages({
     |              ^
  48 |     entities, imageKeys, createNode, createNodeId, touchNode, store, cache, createContentDigest, auth
  49 |   })
  50 |

Make sure that you don't have a typo somewhere and use valid arguments in sourceNodes lifecycle.
Learn more about sourceNodes here: https://www.gatsbyjs.com/docs/reference/config-files/gatsby-node/#sourceNodes

File: node_modules/gatsby-source-custom-api/gatsby-node.js:47:14

success Checking for changed pages - 0.001s

The api I'm querying is here:

http://sculpture-poetry.du.st/conferences.json

and my config:

{
      resolve: "gatsby-source-custom-api",
      options: {
        url: {
          production: "http://sculpture-poetry-cms.test/conferences.json",
          development: "http://sculpture-poetry-cms.test/conferences.json",
        },
        rootKey: "spConferences",
        schemas: {
          spConferences: `
            data: [data]
          `,
          data: `
            uid: String
            title: String
            description: String
            location: String
            byline: String
            startDate: String
            endDate: String
            button: button
            events: [events]
          `,
          events: `
            uid: String
            slug: String
            url: String
            title: String
            type: String
            description: String
            image: image
            eventLink: eventLink
            speakers: [speakers]
            date: String
            startTime: String
            endTime: String
          `,
          speakers: `
            uid: String
            name: String
            url: String
            slug: String
          `,
          image: `
            url: String
          `,
          button: `
            customText: String
            value: String
          `,
          eventLink: `
            customText: String
            value: String
          `,
        },
      },
    },
a-rbsn commented 3 years ago

Looks like this is fixed by doing this:

https://github.com/AndreasFaust/gatsby-source-custom-api/pull/30

and putting the 'auth' object in the config settings.

AndreasFaust commented 3 years ago

I merged the PR and released version 2.3.2.