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

[Bug]: strange Manager.js path that run infinitely in background #30387

Open
paul-nallet opened this issue Jan 27, 2025 · 6 comments
Open

[Bug]: strange Manager.js path that run infinitely in background #30387

paul-nallet opened this issue Jan 27, 2025 · 6 comments

Comments

@paul-nallet
Copy link

Describe the bug

in my project

https://design.copromatic.com/

when you check your console nav you can see many error runs in background with strange url.
i didn't found any relative issues.

https://design.copromatic.com/sb-preview/sb-addons/essentials-backgrounds-5/sb-addons/storybook-core-core-server-presets-0/sb-addons/essentials-viewport-6/sb-addons/links-1/manager-bundle.js

when i run in local with

npx http-server ./storybook-static

There is no errors

I use
storybook 8.5.1
vite 6.0.11
cloudflare pages

Reproduction link

https://design.copromatic.com/

Reproduction steps

No response

System

npx storybook@latest info

Storybook Environment Info:

  System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm <----- active
    pnpm: 9.11.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 132.0.6834.110
    Safari: 17.5
  npmPackages:
    @storybook/addon-essentials: ^8.5.1 => 8.5.1 
    @storybook/addon-interactions: ^8.5.1 => 8.5.1 
    @storybook/addon-links: ^8.5.1 => 8.5.1 
    @storybook/addon-mdx-gfm: ^8.5.1 => 8.5.1 
    @storybook/addon-storysource: ^8.5.1 => 8.5.1 
    @storybook/blocks: ^8.5.1 => 8.5.1 
    @storybook/manager-api: ^8.5.1 => 8.5.1 
    @storybook/test: ^8.5.1 => 8.5.1 
    @storybook/theming: ^8.5.1 => 8.5.1 
    @storybook/vue3: ^8.5.1 => 8.5.1 
    @storybook/vue3-vite: ^8.5.1 => 8.5.1 
    storybook: ^8.5.1 => 8.5.1 
    storybook-version: ^0.1.2 => 0.1.2 
    storybook-vue3-router: ^5.0.0 => 5.0.0

Additional context

No response

Copy link
Contributor

greptile-apps bot commented Jan 27, 2025

** Disclaimer** This information might be inaccurate, due to it being generated automatically
This appears to be related to how Storybook loads manager bundles on Cloudflare Pages. The issue is likely due to incorrect path resolution for manager bundles when deployed. To resolve: 1. Add a custom viteFinal config in .storybook/main.js: js export default { viteFinal: (config) => { if (process.env.CF_PAGES) { config.base = '/'; } return config; } } 2. Add a publicPath setting in .storybook/manager.js: js window.STORYBOOK_MANAGER_CONFIG = { publicPath: '/' }; This should prevent the infinite manager bundle loading attempts by ensuring proper path resolution on Cloudflare Pages.

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Edit Issue Bot Settings · Greptile

@paul-nallet
Copy link
Author

I tried this method, but it didn't solve my problem.

@paul-nallet
Copy link
Author

paul-nallet commented Jan 27, 2025

unfortunately had to rolled back storybook 8.4.5 and works fine.

@adriantrunzo
Copy link

I'm encountering a similar issue when deploying to Cloudflare Pages after migrating to 8.5.x. Oddly, the issue is more noticeable in Chrome than other browsers.

Specifically, the browser repeatedly tries to fetch a number of Storybook related scripts. All of these fetches cause the following error in the console.

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Each of these fetches is actually returning the root Storybook HTML -- so they in turn set off another set of recursive fetches that eventually cause the page to crash after the browser makes tens of thousands of requests.

Screen.Recording.2025-02-03.at.4.32.15.PM.mov

In my case, the fetches involve paths that look like the following. There are many unique paths, so I've only copied a few.

  • /sb-preview/sb-addons/links-3/sb-addons/essentials-toolbars-9/sb-addons/storybook-core-core-server-presets-0/sb-manager/runtime.js
  • /sb-preview/sb-addons/links-3/sb-addons/essentials-toolbars-9/sb-addons/storybook-core-core-server-presets-0/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js
  • /sb-preview/sb-addons/links-3/sb-addons/essentials-toolbars-9/sb-addons/storybook-core-core-server-presets-0/sb-addons/a11y-1/manager-bundle.js
  • /sb-addons/links-3/sb-addons/essentials-toolbars-9/sb-addons/storybook-core-core-server-presets-0/sb-addons/onboarding-2/manager-bundle.js
  • /sb-preview/sb-addons/links-3/sb-addons/essentials-toolbars-9/sb-addons/storybook-core-core-server-presets-0/sb-addons/links-3/manager-bundle.js
  • /sb-preview/sb-manager/sb-addons/essentials-actions-5/sb-addons/essentials-backgrounds-7/sb-addons/onboarding-2/sb-addons/essentials-controls-4/manager-bundle.js
  • /sb-preview/sb-manager/sb-addons/essentials-actions-5/sb-addons/essentials-backgrounds-7/sb-addons/onboarding-2/sb-addons/essentials-actions-5/manager-bundle.js
  • /sb-preview/sb-manager/sb-addons/essentials-actions-5/sb-addons/essentials-backgrounds-7/sb-addons/onboarding-2/sb-addons/essentials-docs-6/manager-bundle.js

And they all return the following HTML (not sure what's up with the formatting for my paste):

  | <!DOCTYPE html>
-- | --
  | <html lang="en">
  | <head>
  | <meta charset="utf-8" />
  |  
  | <title>@storybook/core - Storybook</title>
  | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  |  
  |  
  | <link rel="icon" type="image/svg+xml" href="./favicon.svg" />
  |  
  | <style>
  | @font-face {
  | font-family: 'Nunito Sans';
  | font-style: normal;
  | font-weight: 400;
  | font-display: swap;
  | src: url('./sb-common-assets/nunito-sans-regular.woff2') format('woff2');
  | }
  |  
  | @font-face {
  | font-family: 'Nunito Sans';
  | font-style: italic;
  | font-weight: 400;
  | font-display: swap;
  | src: url('./sb-common-assets/nunito-sans-italic.woff2') format('woff2');
  | }
  |  
  | @font-face {
  | font-family: 'Nunito Sans';
  | font-style: normal;
  | font-weight: 700;
  | font-display: swap;
  | src: url('./sb-common-assets/nunito-sans-bold.woff2') format('woff2');
  | }
  |  
  | @font-face {
  | font-family: 'Nunito Sans';
  | font-style: italic;
  | font-weight: 700;
  | font-display: swap;
  | src: url('./sb-common-assets/nunito-sans-bold-italic.woff2') format('woff2');
  | }
  | </style>
  |  
  | <link href="./sb-manager/runtime.js" rel="modulepreload" />
  |  
  |  
  | <link href="./sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/a11y-1/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/onboarding-2/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/links-3/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/essentials-controls-4/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/essentials-actions-5/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/essentials-docs-6/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/essentials-backgrounds-7/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/essentials-viewport-8/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/essentials-toolbars-9/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/essentials-measure-10/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/essentials-outline-11/manager-bundle.js" rel="modulepreload" />
  |  
  | <link href="./sb-addons/storybook-experimental-addon-test-12/manager-bundle.js" rel="modulepreload" />
  |  
  |  
  | <style>
  | #storybook-root[hidden] {
  | display: none !important;
  | }
  | </style>
  |  
  |  
  | </head>
  | <body>
  | <div id="root"></div>
  |  
  |  
  | <script>
  |  
  |  
  | window['FEATURES'] = {
  | "argTypeTargetsV7": true,
  | "legacyDecoratorFileOrder": false,
  | "disallowImplicitActionsInRenderV8": true
  | };
  |  
  |  
  |  
  | window['REFS'] = {};
  |  
  |  
  |  
  | window['LOGLEVEL'] = "info";
  |  
  |  
  |  
  | window['DOCS_OPTIONS'] = {
  | "defaultName": "Docs",
  | "autodocs": "tag"
  | };
  |  
  |  
  |  
  | window['CONFIG_TYPE'] = "PRODUCTION";
  |  
  |  
  |  
  |  
  |  
  |  
  |  
  | window['TAGS_OPTIONS'] = {
  | "dev-only": {
  | "excludeFromDocsStories": true
  | },
  | "docs-only": {
  | "excludeFromSidebar": true
  | },
  | "test-only": {
  | "excludeFromSidebar": true,
  | "excludeFromDocsStories": true
  | }
  | };
  |  
  |  
  |  
  | window['STORYBOOK_RENDERER'] = "react";
  |  
  |  
  |  
  | window['STORYBOOK_BUILDER'] = "@storybook/builder-vite";
  |  
  |  
  |  
  | window['STORYBOOK_FRAMEWORK'] = "@storybook/react-vite";
  |  
  |  
  | </script>
  |  
  |  
  | <script type="module">
  | import './sb-manager/globals-runtime.js';
  |  
  |  
  | import './sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js';
  |  
  | import './sb-addons/a11y-1/manager-bundle.js';
  |  
  | import './sb-addons/onboarding-2/manager-bundle.js';
  |  
  | import './sb-addons/links-3/manager-bundle.js';
  |  
  | import './sb-addons/essentials-controls-4/manager-bundle.js';
  |  
  | import './sb-addons/essentials-actions-5/manager-bundle.js';
  |  
  | import './sb-addons/essentials-docs-6/manager-bundle.js';
  |  
  | import './sb-addons/essentials-backgrounds-7/manager-bundle.js';
  |  
  | import './sb-addons/essentials-viewport-8/manager-bundle.js';
  |  
  | import './sb-addons/essentials-toolbars-9/manager-bundle.js';
  |  
  | import './sb-addons/essentials-measure-10/manager-bundle.js';
  |  
  | import './sb-addons/essentials-outline-11/manager-bundle.js';
  |  
  | import './sb-addons/storybook-experimental-addon-test-12/manager-bundle.js';
  |  
  |  
  | import './sb-manager/runtime.js';
  | </script>
  |  
  |  
  | <link href="./sb-preview/runtime.js" rel="prefetch" as="script" />
  |  
  | </body>
  | </html>

I've not made any configuration changes in Cloudflare recently and can confirm that the set of files pushed to Cloudflare pre- and post-upgrade to 8.5.x look equivalent. I have several non-Storybook projects on Cloudflare Pages and none of them is experiencing similar issues.

@stropitek
Copy link
Contributor

stropitek commented Feb 5, 2025

I am encountering a similar issue (only affects chrome-based browsers).

The problem is that ./sb-preview/runtime.js does not exist in the build anymore since it was removed from the production build in 511a557

With a SPA setup the request will return index.html since the file does not exist. This is what trigger the infinite requests and I've been able to confirm it with my build: I added an empty /sb-preview/runtime.js file to the build which fixed the problem.

@adriantrunzo
Copy link

The problem is that ./sb-preview/runtime.js does not exist in the build anymore since it was removed from the production build in 511a557

Thanks for narrowing down the issue and providing a workaround.

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

4 participants