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

Support Cloudflare with dynamic import for 'node:crypto' #10

Closed
wants to merge 1 commit into from

Conversation

mw10013
Copy link

@mw10013 mw10013 commented Mar 11, 2024

Closes #9

paddle-node-sdk does not run on Cloudflare because it imports crypto without a node: prefix. Node.js compatibility in Cloudflare requires the node: prefix per https://developers.cloudflare.com/workers/runtime-apis/nodejs/

paddle-node-sdk is cjs and node:crypto on Cloudflare seems to be esm. Cjs must use a dynamic import to import esm.

This PR dynamically imports 'node:crypto'.

In my local environment, 4 tests fail when I run the latest main in paddle-node-sdk. These 4 failures persist with this PR.

Screenshot 2024-03-10 at 8 15 47 PM

https://github.com/mw10013/paddle-cloudflare-worker contains a Cloudflare worker that uses this PR to show the first page of products on Cloudflare. It is deployed here: https://paddle-cloudflare-worker.mw10013.workers.dev/

@vijayasingam-paddle
Copy link
Contributor

Superseded by #20

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

Successfully merging this pull request may close these issues.

[Feature]: Support Cloudflare
2 participants