How to rapidly validate if a JS package will work on Workers runtime?
Like the old 'Works on Workers' catalogue which disappeared. Node.js / javascript / typescript packages.
I know this page exists: https://developers.cloudflare.com/workers/runtime-apis/nodejs/ but without a deep dive into other packages you cannot identify whether a package will 'just work'. As an example of two popular packages,
stripe
works but @sendgrid/mail
doesn't
Is it a matter of trial and error? Or Google [package] cloudflare workers
each time and hope someone has written a blog post? That will become exhausting quickly.
Or assume nothing works and default to building from scratch (or more likely, electing to run my FaaS elsewhere.. 😢 )
This sounded really whingy and I don't intend it to be. I really love the product, it is just not the easiest to use right now!Cloudflare Docs
Node.js compatibility · Cloudflare Workers docs
Implemented Node.js runtime APIs and enablement instructions for your Worker project.
3 Replies
Do most (complying) packages mention that? https://github.com/stripe/stripe-node (this is what
pnpm add stripe
installs) doesn’t seem to mention it but does work? Maybe I’m looking in the wrong placeGitHub
GitHub - stripe/stripe-node: Node.js library for the Stripe API.
Node.js library for the Stripe API. . Contribute to stripe/stripe-node development by creating an account on GitHub.
Some of them just export a browser/Worker build
https://github.com/stripe/stripe-node/blob/d14e271ff7ab285cc264bca1ea3781829266d5bb/package.json#L80-L94
Thanks for this