datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 50 forks source link

Error 404 #135

Closed arminhupka closed 3 years ago

arminhupka commented 3 years ago

Hey, i tried build site but im getting error

404 INVALID_ENVIRONMENT

I'm sure that i provide proper API key.

Here's full error code

rror "gatsby-source-datocms" threw an error while running the sourceNodes lifecycle:

404 INVALID_ENVIRONMENT (details: {})

  ApiException: 404 INVALID_ENVIRONMENT (details: {})

  - Client.js:161 
    [pgaz]/[datocms-client]/lib/Client.js:161:33

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

  - async Promise.all

  - Client.js:145 Client.request
    [pgaz]/[datocms-client]/lib/Client.js:145:94

  - Client.js:54 Client.get
    [pgaz]/[datocms-client]/lib/Client.js:54:19

  - Loader.js:90 Loader.load
    [pgaz]/[datocms-client]/lib/local/Loader.js:90:39

  - index.js:215 _callee2$
    [pgaz]/[gatsby-source-datocms]/hooks/sourceNodes/index.js:215:27

  - index.js:3 asyncGeneratorStep
    [pgaz]/[gatsby-source-datocms]/hooks/sourceNodes/index.js:3:103

  - index.js:5 _next
    [pgaz]/[gatsby-source-datocms]/hooks/sourceNodes/index.js:5:194

  - index.js:5 
    [pgaz]/[gatsby-source-datocms]/hooks/sourceNodes/index.js:5:364

  - new Promise

  - index.js:5 Object.<anonymous>
    [pgaz]/[gatsby-source-datocms]/hooks/sourceNodes/index.js:5:97

  - index.js:258 Object.sourceNodes
    [pgaz]/[gatsby-source-datocms]/hooks/sourceNodes/index.js:258:18

  - api-runner-node.js:460 runAPI
    [pgaz]/[gatsby]/src/utils/api-runner-node.js:460:22

  - api-runner-node.js:589 Promise.catch.decorateEvent.pluginName
    [pgaz]/[gatsby]/src/utils/api-runner-node.js:589:17

  - From previous event:

  - api-runner-node.js:589 Promise.catch.decorateEvent.pluginName
    [pgaz]/[gatsby]/src/utils/api-runner-node.js:589:9

  - From previous event:

  - api-runner-node.js:588 
    [pgaz]/[gatsby]/src/utils/api-runner-node.js:588:14

  - timers.js:456 processImmediate
    internal/timers.js:456:21

  - From previous event:

  - api-runner-node.js:561 
    [pgaz]/[gatsby]/src/utils/api-runner-node.js:561:13

  - From previous event:

  - api-runner-node.js:477 module.exports
    [pgaz]/[gatsby]/src/utils/api-runner-node.js:477:3

  - source-nodes.ts:97 _default
    [pgaz]/[gatsby]/src/utils/source-nodes.ts:97:9

  - source-nodes.ts:24 sourceNodes
    [pgaz]/[gatsby]/src/services/source-nodes.ts:24:9

  - interpreter.js:722 Interpreter.exec
    [pgaz]/[xstate]/lib/interpreter.js:722:27

  - interpreter.js:204 Interpreter.execute
    [pgaz]/[xstate]/lib/interpreter.js:204:22

  - interpreter.js:224 Interpreter.update
    [pgaz]/[xstate]/lib/interpreter.js:224:18

  - interpreter.js:125 
    [pgaz]/[xstate]/lib/interpreter.js:125:23

  - scheduler.js:60 Scheduler.process
    [pgaz]/[xstate]/lib/scheduler.js:60:13

  - scheduler.js:44 Scheduler.schedule
    [pgaz]/[xstate]/lib/scheduler.js:44:14

  - interpreter.js:121 Interpreter.send
    [pgaz]/[xstate]/lib/interpreter.js:121:29

  - interpreter.js:840 actor.id
    [pgaz]/[xstate]/lib/interpreter.js:840:23

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

warning The gatsby-source-datocms plugin has generated no Gatsby nodes. Do you need it?
matjack1 commented 3 years ago

Hello @arminhupka looks like you are referencing a missing sandbox environment.

Could you please share the gatsby.config.js file so that I can have a look?

arminhupka commented 3 years ago

@matjack1 no problem

module.exports = {
  siteMetadata: {
    title: `Gatsby Default Starter`,
    description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
    author: `@gatsbyjs`,
  },
  plugins: [
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
      },
    },
    {
      resolve: `gatsby-source-datocms`,
      options: {
        // You can find your read-only API token under the Settings > API tokens
        // section of your administrative area:
        apiToken: `6ff46e007535bd3a0295exxxxxxxxxxx`,

        // The project environment to read from. Defaults to the primary environment:
        environment: `master`,

        // If you are working on development/staging environment, you might want to
        // preview the latest version of records instead of the published one:
        previewMode: false,

        // Disable automatic reloading of content when some change occurs on DatoCMS:
        disableLiveReload: false,

      },
    },
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
  ],
}
arminhupka commented 3 years ago

Anyone?

stefanoverna commented 3 years ago

Hey, the environment name is wrong for your project, instead of "master" you should use "main"! see https://.admin.datocms.com/admin/environments

Screenshot 2021-01-08 at 08 51 28