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

Modules not resolved with adapter-cloudflare (crypto, stream, http, https, zlib) #227

Closed
BattlefieldDuck opened this issue Oct 20, 2023 · 1 comment

Comments

@BattlefieldDuck
Copy link

BattlefieldDuck commented Oct 20, 2023

General information

  • SDK/Library version: 3.18.0
  • Environment: Cloudflare Pages
  • Language, language version, and OS: Node.js: 18.17.1 on Node.js: 18.17.1

Issue description

Cloudflare Pages doesn't fully support node, so the node lib like "crypto", and "stream" doesn't work on Cloudflare Pages.
The braintree-node library using the node libraries causes the Cloudflare Pages fail to build.

Cloudflare Pages Build log

03:47:45.783 | node_modules/braintree/lib/braintree/digest.js:3:21: ERROR: Could not resolve "crypto"
03:47:45.783 | node_modules/braintree/lib/braintree/document_upload_gateway.js:6:23: ERROR: Could not resolve "stream"
03:47:45.784 | node_modules/braintree/lib/braintree/http.js:4:19: ERROR: Could not resolve "http"
03:47:45.784 | node_modules/braintree/lib/braintree/http.js:5:20: ERROR: Could not resolve "https"
03:47:45.784 | node_modules/braintree/lib/braintree/http.js:6:19: ERROR: Could not resolve "zlib"

There is a similar issue in the Stripe library too.
sveltejs/kit#3564
sveltejs/kit#6547

and they solved it on this PR.
stripe/stripe-node#1679

Possible Solution

Move all platform-specific implementations into PlatformFunctions, like how stripe fixes that issue on that PR.

@hollabaq86
Copy link

👋 @BattlefieldDuck thanks for reaching out and providing this feedback. We're going to take this and discuss internally whether support for platforms that don't support Node APIs directly is something we want to add to the SDK. I don't have an ETA or yes/no decision for you, but we have received your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants