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

Build creating nested storybook UI - Inception! #5269

Closed
dstroot opened this issue Jan 16, 2019 · 21 comments
Closed

Build creating nested storybook UI - Inception! #5269

dstroot opened this issue Jan 16, 2019 · 21 comments
Labels
bug cra Prioritize create-react-app compatibility has workaround needs reproduction

Comments

@dstroot
Copy link

dstroot commented Jan 16, 2019

Describe the bug
A clear and concise description of what the bug is.
Using vanilla Create-React-App, then add storybook, then run build-storybook. Here is the results:
screen shot 2019-01-16 at 11 39 14 am

To Reproduce
Steps to reproduce the behavior:

  • Run CRA
  • Add storybook
  • Run build-storybook
  • serve the results

Expected behavior
A clear and concise description of what you expected to happen.
Storybook should look the same as when you use yarn storybook

Screenshots
If applicable, add screenshots to help explain your problem.

screen shot 2019-01-16 at 11 39 14 am

Code snippets
If applicable, add code samples to help explain your problem.

System:

  • OS:MacOS
  • Device: Macbook Pro 2018
  • Browser: Chrome latest
  • Framework: React
  • Addons: None - Using CRA to bootstrap app
  • Version: 4.1.6 and Latest

Additional context
Add any other context about the problem here.

@tmeasday
Copy link
Member

tmeasday commented Jan 17, 2019

Hi @dstroot, thanks for the report.

I tried to reproduce this with react-scripts@2.1.3 and @storybook/react@4.1.6 and I am not seeing the problem. I opened the built storybook directly (as in file://) and served it with npx serve.

I wonder how you are serving your built storybook? Perhaps it is somehow redirecting /iframe.html to /?

@tmeasday tmeasday added bug needs reproduction cra Prioritize create-react-app compatibility labels Jan 17, 2019
@shilman
Copy link
Member

shilman commented Jan 17, 2019

@tmeasday His screenshot is from SB5, not SB4. However I was not able to reproduce on 5.0.0-alpha.4 (the latest next). I tried both serve and file:// params.

@shilman
Copy link
Member

shilman commented Jan 17, 2019

Found this other nice bug while trying to repro 😉 : #5274

@dstroot
Copy link
Author

dstroot commented Jan 18, 2019

I am going to close this - just tried again with npx serve and no issues. I was using "serve" installed globally (npm -g) but I doubt that is the real root cause. So weird - yesterday no matter what I could not get it to work and today is works great.

@efmr
Copy link

efmr commented Jun 19, 2019

Found the same issue, to reproduce it:

serve -s storybook-static

Removing the single page app flag fixes it:

serve storybook-static

@dstroot
Copy link
Author

dstroot commented Jun 24, 2019

@efmr > Gah! That was it!

@ksegal
Copy link

ksegal commented Nov 6, 2019

I encountered this same resulting nested storybook behavior but the cause of the bug was slightly different. There is a bug in the babel 7.7.0 release, reported here. As a result of these type errors, my storybook build fails but then renders like the image above. Once this fix is out in a release, it should be safe to upgrade, but until then you may want to lock in the babel 7.6 minor version.

@shilman
Copy link
Member

shilman commented Nov 7, 2019

Thanks @ksegal! Hope they get that fix out soon 🙏

@jimjeffers
Copy link

What exactly is the solution to this issue? Or what are the steps to troubleshoot this? It's not clear to me why this is occurring.

@shilman
Copy link
Member

shilman commented May 6, 2021

@jimjeffers
Copy link

jimjeffers commented May 6, 2021

Thanks @shilman in this case I'm not using serve - I just deployed a static build to an S3 bucket but I'm getting the crazy inception issue. I just tried using serve without the -s flag but still get the inception! So odd. I can't spot any errors in the console so I'm having trouble debugging this one. I must have a different issue but same outcome as has been discussed on this thread.

The storybook causing this same inception issue is here in case there's an obvious way to debug the problem (the storybook works fine when running dev server - it's just an issue with the static build):
http://gigzilla-stories.s3-website-us-west-2.amazonaws.com/?path=/story/example-introduction--page

@shilman
Copy link
Member

shilman commented May 6, 2021

Are you using the -p option?

@jimjeffers
Copy link

@shilman This is what I've been using to deploy:

{
// ...
        "deploy-storybook": "storybook-to-aws-s3 --bucket-path=gigzilla-stories --aws-profile=gigzilla-storybook",
        "build-storybook": "build-storybook -s public",
//...
}

@jimjeffers
Copy link

@shilman here are the versions I'm on if it helps:

    "devDependencies": {
        "@storybook/addon-actions": "^6.2.9",
        "@storybook/addon-essentials": "^6.2.9",
        "@storybook/addon-links": "^6.2.9",
        "@storybook/node-logger": "^6.2.9",
        "@storybook/preset-create-react-app": "^3.1.7",
        "@storybook/react": "^6.2.9",
        "@storybook/storybook-deployer": "^2.8.7",
     }

@shilman
Copy link
Member

shilman commented May 6, 2021

Does it also have that problem when you serve locally?

@jimjeffers
Copy link

@shilman Looks like it! If I build locally and run serve from the output dir as such:

storybook-static % npx serve

I get that recursion issue. No errors in the console however.

@shilman
Copy link
Member

shilman commented May 6, 2021

Are there any soft links in the public directory? Do you have a repro you can share?

@jimjeffers
Copy link

@shilman I gave up and just moved the components/stories into a fresh CRA project. I have no idea what was causing it but we're migrating the project anyway. It would be handy if there was a way to isolate the error that causes the 'inception' though! My guess is it happens somewhere in the iframe which is why we don't see any errors in the inspector?

@nilslp
Copy link

nilslp commented Mar 8, 2022

Did anyone manage to find a solution for this?

All was working locally via yarn start (dev) and when yarn build (production) then serving.
Once we tested a deployment on amplify the inception UI issue appeared.

@Alpha1337k
Copy link

@nilslp Take a look at the redirects of amplify. It might be that all requests would be redirected to /index.html instead of /iframe.html etc.

Hope this helps.

@nilslp
Copy link

nilslp commented Nov 4, 2022

@nilslp Take a look at the redirects of amplify. It might be that all requests would be redirected to /index.html instead of /iframe.html etc.

Hope this helps.

You were right @Alpha1337k, I had meant to return to post this as amplify was the issue all along. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cra Prioritize create-react-app compatibility has workaround needs reproduction
Projects
None yet
Development

No branches or pull requests

8 participants