Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Storybook making a request to Drupal #45

Open
fogpuddle opened this issue Oct 27, 2023 · 6 comments
Open

Error with Storybook making a request to Drupal #45

fogpuddle opened this issue Oct 27, 2023 · 6 comments

Comments

@fogpuddle
Copy link

I'm following the walkthrough at https://git.drupalcode.org/project/cl_server/-/blob/2.x/docs/storybook.md, but am running into an error with Storybook connecting with Drupal using this addon. I'm not sure if I'm missing some setting in the walthrough, but I went through this many times getting this error. This is what I'm seeing using DDEV to set this up.

Screenshot 2023-10-27 at 10 37 53 AM

It could be an error with CL Server, but I made sure then endpoint was accessible to anonymous users in the Drupal settings.

There is a part in the walkthrough where it says this:

"Storybook will start in http://localhost:6006/ and you will see a black and red screen with an error. This is because you need to set the Components config in Drupal."

As you can see in the screenshot, I am seeing a black and red screen with an error in storybook, but I'm not sure where to go to set the Components config in Drupal nor what to set in the config if that is indeed the problem.

@fogpuddle
Copy link
Author

I'm just following up. Is anybody else seeing this error or is there a step I'm missing that will resolve the Storybook issue mentioned above.

@e0ipso
Copy link
Member

e0ipso commented Nov 23, 2023

@fogpuddle what are you seeing in the JS console?

@fogpuddle
Copy link
Author

@e0ipso This is what I'm seeing in the console:

Screenshot 2023-11-27 at 11 32 49 AM

When I look at the cl_server path in the network tab. I see the 404 status code for the request URL of
https://storybook-sdc.ddev.site:6006/_cl_server?_storyFileName=.%2Fweb%2Fthemes%2Fcustom%2Fstorybook_sdc%2Fcomponents%2Fmy-banner--tall%2Fmy-banner--tall.stories.yml&_drupalTheme=undefined&_params=eyJoZWFkaW5nIjoiSm9pbiB1cyBhdCBUaGUgQ29uZmVyZW5jZSIsImltYWdlIjoiaHR0cHM6Ly9waWNzdW0ucGhvdG9zL3NlZWQvYWZmc2UzLzEyMDAvOTUwIiwiY3RhVGV4dCI6IlJlZ2lzdGVyIiwiY3RhSHJlZiI6Imh0dHBzOi8vd3d3LmV4YW1wbGUub3JnIn0%3D

Within the above URL, I notice the drupalTheme parameter as being undefined. Could it be related to how I set up the custom theme in preview.js?

globals: { drupalTheme: "storybooksdc", supportedDrupalThemes: { storybooksdc: {title: "storybook_sdc"}, olivero: { title: "Olivero" }, claro: { title: "Claro" }, }, },

CL Server is enabled in Drupal and the permission for CL Server Endpoint is set to anonymous.

@e0ipso
Copy link
Member

e0ipso commented Nov 27, 2023

Is the module/theme that contains the components enabled?

Do click on that link to see if it paints the component in Drupal.

@fogpuddle
Copy link
Author

@e0ipso The theme that contains the components was enabled. When clicked the link, I get "Cannot GET /_cl_server."

I'm wondering if it's something in the DDEV configuration or development.services.yml file that's preventing the Drupal connection. I'll take another look, but I'm not too knowledgable about those settings.

@fogpuddle
Copy link
Author

@e0ipso Coming back to this, I was able to resolve the 404 issue after many reinstalls. I believe it had to do with Drupal configurations and/or caching issues, but I couldn't pinpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants