-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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]: Config.base not getting appended correctly #20138
Comments
@IanVS you asked me to tag you here after creating the bug |
When you mention the first and second requests, are these in a single page load, or when you refresh the page? What happens when you don't set the config.base with This is failing in github pages, right? Does it also fail if you use |
When I load the page this is the http-requests. I am not reloading anything and when I do reload its the same problem. As you can see the first request has the correct config.base and gets the requests correctly the second at the bottom doesnt When we used Storybook 6 I had to set the config.base for it to understand the storybook static site was hosted on our github-page /DesignSystem/ I can try to remove the config.base and get back to you soon. |
What happens when you don't set the config.base with BASE_URL, does that make any difference? This is failing in github pages, right? Does it also fail if you use npx http-server <path/to/storybook/output>? The difference here is I have no /DesignSystem/ as a part of all http-requests when run from http-server |
@ndelangen we'll have to look into this, whether the way we are serving |
@tomasbillborn Not yet. Working through high priority bugs identified by the beta. This is on the list! |
I have exactly the same problem, in an nginx. The "second" failing request comes from this import in import "/sb-preview/runtime.mjs"; Maybe this should be import "./sb-preview/runtime.mjs"; Instead? |
One more bit of information: I added a nginx rewrite rule to fix the issue specifically for |
@marvinroger I think the nginx rewrite-rule doesn't change the url request in the browser, so I think this PR might actually fix the problem: #20232 |
No, it's a server-side workaround on my end, clearly not a solution. On first look, it seems like your PR is fixing the runtime.mjs issue, but as stated above it's not the only problem unfortunately. |
This problem only happens when there is a config.base change, never locally when one is not present. So most likely when you are in the iframe context this config.base is not appended. |
Ooh-la-la!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.7 containing PR #20232 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
I can confirm the issue is fixed on my side with the latest beta, thanks a lot for your reactivity! |
Thanks for reporting back! |
Awesome! |
Now sb-preview works, thank you for that! But for some reason _getPrototype.632da1a4.js all files starting with an underscore and I am not getting this locally. I double checked Actions in github and the files are built Failed to fetch dynamically imported module: https://xxx.github.io/DesignSystem/assets/preview.367c954f.js Any clue why this could happen? @IanVS @ndelangen ? |
@tomasbillborn I do not, but those are files generated by the vite builder, I can't be 100% sure without investigating fully, but from the looks of things that's just vite's output, and I'd have no idea why github isn't properly hosting those. |
Is there a special reason these files must be named with the convention "_"? @ndelangen @IanVS @shilman I am guessing I am not the only one that is going to have to this problem and it wasnt that easy to understand. |
@tomasbillborn Is there anything in your vite config that might be causing this? |
No the problem is files that start with "_" are by default seen as files that should be not be copied By default, Jekyll doesn't build files |
I don't think it's in the storybook scope to handle the specificities of the different hostings. @tomasbillborn you can create a This could, however, be a tip in the storybook docs. 😉 |
You're asking me why does the filename start with a I understand the leading We do not configure vite to prefix things with |
I never said I didnt get it to work. I added the .nojekyll file, but when you build with gh-pages (npm) for some reason you have to add an undocumented flag (tschaub/gh-pages#315) -t true for it to actually add things correct such as a touch .nojekyll file into the branch I am deploying to. What I said was there are most likely more people then me that uses github pages to host storybook. So I never told you to change it, I asked if there was no particular reason for the name convention maybe you could change it to make life easier for others who are going to run into this. I appreciate your fast response and all the help you given @ndelangen |
@tomasbillborn thanks for bringing it up. Storybook itself is not intentionally creating these files. I'm not positive where they're coming from, but they might be generated by babel or vite or some other tool in the chain. It's unfortunate that GitHub pages don't play nicely with them by default, but I'm not sure there is anything we could do to name them differently, unfortunately. |
Well maybe what @marvinroger said is the best way forward. Put it in the documentation if possible. |
Describe the bug
Second http-request of runtime-mjs => sb-preview is not getting config.base appended correctly in Storybook 7 when deployed to github pages resulting in a 404
To Reproduce
System
Additional context
No response
The text was updated successfully, but these errors were encountered: