-
Notifications
You must be signed in to change notification settings - Fork 10.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
Error while building with react-stripe-elements #2505
Comments
Help mentions this point as well.
How can we check if window/document is defined? Because anything I use to check, still throws that error. Is there a better way to check if gatsby is building so we can shortcut the render method? |
I added a code sample to the doc page — lemme know if that helps #2517 |
Thank you @KyleAMathews , that is really helpful. The react-stripe-elements related error is gone but getting this below error. This error specifically comes from that payment related page. If I remove that page and build it all goes fine. We are using latest gatsby version 1.9.72. I noticed there is a thread #1846 but solutions in that issue didn't help. Appreciate some on hints on how to move forward.
|
That's a webpack bug — that there's not a ton we can do other than upgrade to webpack 3 (which we're in process of) My unhelpful suggestion is to use css-in-js ;-) |
I'd understand. Css in js, just for that page which uses stripe or all pages? |
Is there a way to skip building this page and make it completely dynamic? I thought about creating separate html page and putting into |
I'm still working through this. Will update how it goes. Btw, any timeframe guestimate for Gatsby 2.0 with Webpack 3.0 integration? |
In the next month |
An update on stripe integration. I re-did the stripe integration using example given on react-stripe-elements repo combined with Kyle's example of skipping rendering during build process, made stripe integration work fine. So we now have a complete gatsby static site, except for payment details page, which is completely dynamic including posting payment tokens to server, getting activation keys and displaying on screen. @KyleAMathews thank you for awesome library you created. I will close the issue now. If anybody reading this, wants to see an real example of stripe integration, ping me at brsanthu at gmail. |
Hi guys i have the same problem with react-stripe-elements, but my issue it's different. The message it's this:
success delete html and css files from previous builds — 0.023 s info bootstrap finished - 2.782 s success Building CSS — 7.754 s error Building static HTML for pages failed See our docs page on debugging HTML builds for help https://goo.gl/yL9lND Error: It looks like you are trying to inject Stripe context outside of an Elements context.
npm ERR! code ELIFECYCLE I don't know what happen because the develop mode it works fine. |
We are trying to integrate Stripe elements (via react-stripe-elements). The checkout form page comes out fine in develop mode and can see our form as well as Stripe form. But when we start the build, we get following error.
Help page says, move the code into
componentDidMount
to avoid code checking for document/window etc., I could not figure out how to do that. Any help is appreciated.The text was updated successfully, but these errors were encountered: