Add document troubleshooting Storybook configuration

Created on 16 May 2024, about 1 month ago

Problem/Motivation

There are some nuances in configuring Storybook, this issue is to update README.md with tips to debug and fixing the setup:

<!--break-->

Case 1: Error rendering component with Storybook

If the component doesn't render in Storybook and inspecting network request showing a request with an error response:

http://[DRUPAL-SITE]/storybook/stories/render/{hash}?...

This is because server url in JSON stories generated via drush storybook:generate-all-stories are http. Then when Storybook request to Drupal via http get eventually rejected. This is caused by either ddev certificate config issue, or by custom drush alias enforcing http.

Solution:
- Consider fixing ddev config as shown in https://stackoverflow.com/questions/65111024/ddev-project-starts-up-site...
- Or, create a Drush site alias with uri using https
- Run ddev drush st | grep "Site URI" to verify the current protocol is https

Case 2: Issue when migrating from CL Server into Storybook

If all components don't render in Storybook and inspecting network requests in Storybook showing a request to

http://[DRUPAL-SITE]/storybook/stories/render/_cl_server?_storyFileName=.%2Fdocroot%2Fmodules%2Fcustom%2[MY-MODULE]%2Fcomponents%2Fbutton%2Fbutton.stories.json&_drupalTheme=testTheme

Unlike with CL Server, the new Storybook module no longer requires @lullabot/storybook-drupal-addon. This add-on should be removed from the .storybook/main.js.

📌 Task
Status

Needs review

Version

1.0

Component

Documentation

Created by

🇨🇦Canada Robert Ngo Montreal ⚜️

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

Comments & Activities

Production build 0.69.0 2024