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

[Feature]: Support Cloudflare #9

Closed
mw10013 opened this issue Mar 11, 2024 · 3 comments · Fixed by #20 or #24
Closed

[Feature]: Support Cloudflare #9

mw10013 opened this issue Mar 11, 2024 · 3 comments · Fixed by #20 or #24
Assignees

Comments

@mw10013
Copy link

mw10013 commented Mar 11, 2024

Tell us about your feature request

Tweak paddle-node-sdk so that it runs on Cloudflare.

What problem are you looking to solve?

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.

Additional context

No response

How important is this suggestion to you?

Critical

@vijayasingam-paddle
Copy link
Contributor

Hi @mw10013,
Brilliant feedback and thank you for the Pull request.

We will do some testing and get back to you.

Thank you.

@vijayasingam-paddle
Copy link
Contributor

Hi @mw10013,
We checked your PR and we agree that changing the two offending imports might fix the problem for now. However, there is a good chance we could start using some other Node JS feature breaking the ESM compatibility.

As a strategic solution, We have updated the package to export both CommonJS and ESM format so that the build systems can pick up the appropriate format.

We have released a beta version 1.3.0-beta.0 to trial this approach. We will move it to the main branch after it is field tested for a while.

Please use the new version and let us know how it goes.

Thank you.

@mw10013
Copy link
Author

mw10013 commented Mar 27, 2024

@vijayasingam-paddle 1.3.0-beta.0 works in my paddle-cloudflare-worker smoke test (https://paddle-cloudflare-worker.mw10013.workers.dev/ displays the first page of products). Also, in the project I'm working on which includes reconciling database with paddle, changing subscriptions, and webhook. Gratitude!

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