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] Stuck "Loading..." overlay and JS error "Stripe is not defined" when assets built with NODE_ENV=production #1060

Closed
BenSturmfels opened this issue Mar 23, 2022 · 2 comments · Fixed by #1064
Labels
bug Something isn't working

Comments

@BenSturmfels
Copy link
Contributor

On the main branch, when I pre-build the assets with rm -rf public/packs && bin/rake assets:precompile, the Houdini dashboard get stuck with a greyed out "Loading..." overlay and the following JS console errors:

ReferenceError: Stripe is not defined
ReferenceError: appl is not defined
Uncaught ReferenceError: I18n is not defined

2022-03-23_12-34

If instead I rm -rf public/packs and run up the development server and let it build the assets, the dashboard loads with no issues. Similarly no issues if I rm -rf public/packs && NODE_ENV=development bin/rake assets:precompile. The difference between the

The seems independent of whether I'm running the development server or the production server (with removed font-assets and config.reload_routes = false as per #1046 and #1054 to allow production to start).

The page__strip_wrapper JS file where Stripe is defined is being loaded, as shown in the above screenshot and it seems to be loaded before the error occurs. It seems that either the page__strip_wrapper JS isn't running or is being broken somehow by the production Webpack build process. I tried adding a console.log('Hello from Stripe!') at the bottom of app/javascript/legacy/stripe_wrapper/index.es6 and rebuilding. The console message showed up for the inline development build, but not for the assets:precompile build.

I found that removing the environment.SplitChunks block from config/webpack/production.js and building with rm -rf public/packs && bin/rake assets:precompile also works, so the issue would appear to be related to chunking.

@BenSturmfels BenSturmfels added the bug Something isn't working label Mar 23, 2022
@BenSturmfels BenSturmfels changed the title [BUG] JS error "Stripe is not defined" when assets built with bin/rake assets:precompile [BUG] Stuck "Loading..." overlay and JS error "Stripe is not defined" when assets built with NODE_ENV=production Mar 23, 2022
@wwahammy
Copy link
Member

So I doubt this is the problem but one thing you should consider is you shouldn't use bin/rake. Since at least version 6, rake tasks can be called via bin/rails.

@wwahammy
Copy link
Member

I think I know the problem here, let me verify

BenSturmfels added a commit to BenSturmfels/houdini that referenced this issue Mar 25, 2022
In houdiniproject#1060, @wwahammy mentioned that this is recommended approach as of ~ Rails 6.
wwahammy pushed a commit that referenced this issue Mar 25, 2022
In #1060, @wwahammy mentioned that this is recommended approach as of ~ Rails 6.
wwahammy pushed a commit to wwahammy/houdini that referenced this issue Jan 6, 2023
In houdiniproject#1060, @wwahammy mentioned that this is recommended approach as of ~ Rails 6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants