storyblok / gatsby-source-storyblok

Gatsby source plugin for building websites using the Storyblok headless CMS as a data source.
MIT License
43 stars 35 forks source link

"message" is not allowed (on clean Gatsby v5.5.0 repo) #182

Closed mitchuman closed 1 year ago

mitchuman commented 1 year ago

On a clean install of Gatsby v5.5.0 and only the gatsby-source-storyblok plugin installed, I get a console error saying "message" is not allowed.

No pages are setup, just added in gatsby-config.js and the issue occurs.


Expected Behavior

At least have the local server and the GraphQL server up and running.

Current Behavior

Only addition to gatsby-config.js is the following:

{
    resolve: 'gatsby-source-storyblok',
    options: {
        accessToken: '...',
        version: 'draft',
        localAssets: true, // Optional parameter to download the images to use with Gatsby Image Plugin
        // languages: ['en'] // Optional parameter. Omission will retrieve all languages by default.
    }
},

Output:

$ gatsby develop
success compile gatsby files - 0.422s
success load gatsby config - 0.036s
warn Plugin gatsby-source-storyblok is not compatible with your gatsby version 5.5.0 - It requires gatsby@^3.0.0 || ^4.0.0
warn Plugin gatsby-source-storyblok is not compatible with your gatsby version 5.5.0 - It requires gatsby@^3.0.0 || ^4.0.0
success load plugins - 0.408s
success onPreInit - 0.010s
success initialize cache - 0.158s
success copy gatsby files - 0.190s
success Compiling Gatsby Functions - 0.275s
success onPreBootstrap - 0.299s
success createSchemaCustomization - 0.011s
Failed to validate error [Error [ValidationError]: "message" is not allowed] {
  _original: {
    context: {},
    message: Error: Unauthorized
        at /.../node_modules/@storyblok/react/dist/storyblok-react.js:1:7660
        at new Promise (<anonymous>)
        at dt._statusHandler (/.../node_modules/@storyblok/react/dist/storyblok-react.js:1:7586)
        at dt._methodHandler (/.../node_modules/@storyblok/react/dist/storyblok-react.js:1:7472)
        at processTicksAndRejections (node:internal/process/task_queues:95:5)
        at /.../node_modules/@storyblok/react/dist/storyblok-react.js:1:12891,
    response: {
      data: [Object],
      headers: [Object],
      status: 401,
      statusText: 'Unauthorized'
    },
    text: 'There was an unhandled error and we could not retrieve more information. Please run the command with the --verbose flag again.',
    level: 'ERROR',
    category: 'UNKNOWN',
    type: 'UNKNOWN',
    stack: [],
    docsUrl: 'https://gatsby.dev/issue-how-to'
  },
  details: [
    {
      message: '"message" is not allowed',
      path: [Array],
      type: 'object.unknown',
      context: [Object]
    }
  ]
}
not finished source and transform nodes - 0.529s

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Steps to Reproduce

package.json

"dependencies": {
    "gatsby": "^5.5.0",
    "gatsby-plugin-image": "^3.5.0",
    "gatsby-plugin-sharp": "^5.5.0",
    "gatsby-plugin-sitemap": "^6.5.0",
    "gatsby-source-filesystem": "^5.5.0",
    "gatsby-source-storyblok": "^5.0.0",
    "gatsby-transformer-sharp": "^5.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  }
  1. Setup clean Gatsby v.5.5.0
  2. Install gatsby-source-stroyblok
  3. Add gatsby-config.js settings
  4. Run yarn develop or npm run develop
  5. Error
jclark-vanish commented 1 year ago

Similar issue with Gatsby. Looks like it is not ready for Gatsby 5, but also getting this error with "gatsby": "^4.0.2". I tried both with the results

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

{
  "name": "hotel-laguna",
  "version": "1.0.0",
  "private": true,
  "description": "Hotel Laguna",
  "author": "jeff clark",
  "keywords": [
    "gatsby"
  ],
  "scripts": {
    "develop": "gatsby develop",
    "start": "gatsby develop",
    "build": "gatsby build",
    "serve": "gatsby serve",
    "clean": "gatsby clean"
  },
  "dependencies": {
    "bootstrap": "^5.1.3",
    "gatsby": "^4.0.2",
    "gatsby-plugin-anchor-links": "^1.2.1",
    "gatsby-plugin-image": "^2.1.0",
    "gatsby-plugin-mailchimp": "^5.2.2",
    "gatsby-plugin-react-helmet": "^5.1.0",
    "gatsby-plugin-sharp": "^4.1.0",
    "gatsby-plugin-smoothscroll": "^1.2.0",
    "gatsby-source-filesystem": "^4.1.0",
    "gatsby-source-storyblok": "^5.0.0",
    "gatsby-transformer-sharp": "^4.1.0",
    "react": "^17.0.1",
    "react-bootstrap": "^2.0.1",
    "react-dom": "^17.0.1",
    "react-helmet": "^6.1.0",
    "swiper": "^7.2.0"
  }
}
module.exports = {
  siteMetadata: {
    siteUrl: "https://www.yourdomain.tld",
    title: "Some Site",
  },
  plugins: [
    "gatsby-plugin-image",
    "gatsby-plugin-react-helmet",
    "gatsby-plugin-sharp",
    {
      resolve: "gatsby-plugin-anchor-links",
      options: {
        offset: -116,
        duration: 700,
      }
    },
    "gatsby-transformer-sharp",
    {
      resolve: "gatsby-source-filesystem",
      options: {
        name: "images",
        path: "./src/images/",
      },
      __key: "images",
    },
    {
      resolve: "gatsby-source-storyblok",
      options: {
        accessToken: "token here",
        version: "draft",
        localAssets: true, // Optional parameter to download the images to use with Gatsby Image Plugin
        // languages: ['de', 'at'] // Optional parameter. Omission will retrieve all languages by default.
      },
    },
  ],
};
schabibi1 commented 1 year ago

@mitchuman @jclark-vanish Could you try with an updated version of our gatsby-source-storyblok which supports Gatsby 5?

From v6.1.0, it supports Gatsby 5. Let us know if you still have the same/another issue.