Cannot use Package "stripe" in Hydrogen due to Cloudflare Worker Runtime #1615
Unanswered
christiankozalla
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there,
I have a Hydrogen storefront created via
npm create @shopify/hydrogen@latest
(JavaScript, CSS Modules). Now I want to use Stripe as an external payment provider, because the stores location is not supported by Shopify Payments.But when I run the development server or build the project and run the production build, I get an error:
There are two calls to
process.env.NODE_DEBUG
indist/worker/index.js
which are the main problem here, I suspect.process.env.NODE_DEBUG
comes from package "util" (util/util.js) which is imported by package "qs". "qs" exposes a functionstringify
which is used in "stripe". "qs" uses "side-channel" which uses "object-inspect" which imports from Node.js' standard-lib "util"I understand that Hydrogen runs in a Cloudflare Worker environment where Node.js is unavailable and usage of Node's "util" module needs to be polyfilled by the package "util". But since the whole "util/util.js" file, which contains
process.env.NODE_DEBUG
, is copied into my "dist/worker/index.js" I must manually remove this line in order to run the build.I just read that the Worker environment supports a bit of Node's "process" APIs
What could I do to use "stripe" in Hydrogen? Any help is appreciated! Thank you!
Beta Was this translation helpful? Give feedback.
All reactions