Missing schema information for all SDC components in the CL Server is causing a 500 error in the Storybook.

Created on 7 November 2023, 8 months ago
Updated 9 November 2023, 8 months ago

Problem/Motivation

First of all, a big thank you to the module developers.
Unfortunately we have a problem.
We installed Single Directory Components (sdc) and Theme Server (cl_server) and followed these instructions to install Storybook:
https://git.drupalcode.org/project/cl_server/-/blob/2.x/docs/storybook.md
We also installed the sdc Example modules.
The components work and can also be inserted into the Twig template. We only have a problem with Storybook in connection with the cl_server. The endpoint from the cl_server always has a response 500 with the error:

Drupal\sdc\Exception\InvalidComponentException: The component "sdc_examples:my-cta" does not provide schema information. Schema definitions are mandatory for components declared in modules. For components declared in themes, schema definitions are only mandatory if the "enforce_sdc_schemas" key is set to "true" in the theme info file. in Drupal\sdc\Component\ComponentValidator->validateDefinition() (line 62 of modules/contrib/sdc/src/Component/ComponentValidator.php).

in this example it is the components from the sdc_epample module "sdc_examples:my-cta"

My own components in the theme folder (under /web/themes/custom/my_theme/components) have the same error.

Putting the components inside of /web/themes/custom/my_theme/templates/components will also not work, with a different error, that the plugin cannot be found. So putting the components inside of /web/themes/custom/my_theme/components feels right.

Steps to reproduce

Install:
Drupal 10.1.6
sdc:^2.0@alpha
sdc_examples
cl_server:^2.0@beta
Storybook 6.5, I've already tried version 7.5 as well with no success
package.json

 "devDependencies": {
    "@babel/core": "^7.21.4",
    "@lullabot/storybook-drupal-addon": "^1.0.27",
    "@mdx-js/react": "^1.6.22",
    "@storybook/addon-actions": "^6.5.16",
    "@storybook/addon-docs": "^6.5.16",
    "@storybook/addon-essentials": "^6.5.16",
    "@storybook/addon-links": "^6.5.16",
    "@storybook/builder-webpack5": "^6.5.16",
    "@storybook/cli": "^6.5.16",
    "@storybook/manager-webpack5": "^6.5.16",
    "@storybook/server": "^6.5.16",
    "babel-loader": "^8.3.0"
  }

Storybook installed according to instructions:
https://git.drupalcode.org/project/cl_server/-/blob/2.x/docs/storybook.md

We get this error message on the /_cl_server endpoint:

https://my-local-page/_cl_server?_storyFileName=.%2Fweb%2Fmodules%2Fcont...()

error message:
Drupal\sdc\Exception\InvalidComponentException: The component "sdc_examples:my-cta" does not provide schema information. Schema definitions are mandatory for components declared in modules. For components declared in themes, schema definitions are only mandatory if the "enforce_sdc_schemas" key is set to "true" in the theme info file. in Drupal\sdc\Component\ComponentValidator->validateDefinition() (line 62 of modules/contrib/sdc/src/Component/ComponentValidator.php).

We currently have no idea what the reason for this error is and are hoping for help.

Thanks

πŸ› Bug report
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany Greenhorn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Greenhorn
  • Status changed to Closed: works as designed 8 months ago
  • πŸ‡©πŸ‡ͺGermany Greenhorn

    It works now. We think that having the SDC module now included in Core from Drupal 10.1, you have to follow another process.

    we did following steps to make it work:

    at first we have disabled following modules:
    - sdc:^2.0@alpha
    - sdc_examples
    - cl_server:^2.0@beta

    after that you also can remove entirely following module:
    - sdc:^2.0@alpha

    Then enable the Core SDC module and cl_server:^2.0@beta,

    Now setting up the Storybook works well following these instructions:
    https://git.drupalcode.org/project/cl_server/-/blob/2.x/docs/storybook.md

    Please note that from Storybook 7 onwards in the ".storybook/main.js"
    select only one format. This is also well described in the sdc_examples module in the Readme.md

    stories : [
         "../web/themes/**/*.stories.@(json|yml)"
       ],

    use

    stories : [
         "../web/themes/**/*.stories.yml"
        ],

    Many thanks to the developers!

Production build 0.69.0 2024