storybookjs/storybook

[Bug]: CORS issue with Storybook composer and hostname

Open

#24,329 opened on Sep 28, 2023

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (10,058 forks)batch import
compositionhelp wantedquestion / support

Repository metrics

Stars
 (89,909 stars)
PR merge metrics
 (Avg merge 7d 22h) (184 merged PRs in 30d)

Description

Describe the bug

I'm using the Storybook composer to load in other Storybooks, these Storybooks also have a custom hostname. When running the composer I hit the following issue:

Uncaught TypeError: Cannot read properties of null (reading 'storyId')
    at chunk-45GKKSU6.js:398:54577
    at Array.map (<anonymous>)
    at chunk-45GKKSU6.js:398:54428
    at renderWithHooks (chunk-NBCGHFLK.js:69:936)
    at updateFunctionComponent (chunk-NBCGHFLK.js:69:48263)
    at updateSimpleMemoComponent (chunk-NBCGHFLK.js:69:46640)
    at updateMemoComponent (chunk-NBCGHFLK.js:69:44544)
    # ....

Access to fetch at 'https://web.bitttttten.com:7007/index.json' from origin 'https://web.bitttttten.com:7006' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
:7007/stories.json:1

The composer is run with storybook dev -p 6006 -h 'web.bitttttten.com', and there is a proxy that proxies 7006 to 6006 so you're able to have storybook running locally on 6006, and with SSL at https://web.bitttttten.com:7006.

The storybook is run with storybook dev -p 6007 -h 'web.bitttttten.com'.

To Reproduce

Run with hostname and composer and see the CORS issue.

If there is any other info needed, please let me know.

Contributor guide