-
Notifications
You must be signed in to change notification settings - Fork 757
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 Request] Using stripe-node outside of Node.js (e.g. Cloudflare Workers or Deno) #997
Comments
Hi @brillout! Thanks for the feature request. Cloudflare or Deno isn't something we've investigated in depth yet but it would be interesting to learn more. You might be able to help us out a little bit by elaborating a little bit about your use case -- how you would interact with with Stripe from a Cloudflare worker and what value this would unlock for you. We did a little bit of work towards decoupling the library from the 'child_process' API in #775, which we were just using incidentally. If I understand correctly, I think in order to meet your need we would need to decouple from the 'http' Node API as well, that we use in StripeResource, and we are unfortunately quite far from today. |
Hi @richardm-stripe ! I want to be able to accept donations with credit cards on https://www.clocktab.com/ and https://www.timer-tab.com/. These two website are static/serverless; I don't need to maintain any server which is super convenient. I'd like to keep the serverless architecture. I could use AWS lambda instead and that would just work. But I'm intrigued by the Cloudflare Workers Webassembly approach and avoiding cold start would be a neat thing. So my use case is not crucial; I'm just checking out options. Wouldn't it be possible to "simply" (I don't know the details here) to expose functions that take an object holding the HTTP request url, path, headers, and body in a platform agnostic format and likewise return a platform independent object holding the HTTP response headers and payload? You could then expose these platform independent functions as well as expose Node.js, Cloudflare, and Deno wrappers. |
Hey @richardm-stripe @brillout — I'm on the Workers team 👋 I'm super interested in helping this land! I've been playing around with the Stripe API inside of Workers and it seems like the |
Can we allow Fetch to be passed into configuration for custom implementation that matches WebAPI spec? Something like
|
Hi all, we'd be excited about adding support for fetch, but don't have immediate plans to prioritize the implementation; however if anybody is interested in putting together a proof-of-concept, that could be a lot of help. What I'm envisioning is that instead of calling |
We'd like to be able to onboard Stripe Connect users via CloudFlare workers - is something like that currently possible? We'd prefer not to host the connect/payment functionality and have some way of ensuring uptime... |
I see two ways to do this:
While I personally would prefer the latter as it means first class support in the browser, the first might be easier to pull off without refactoring too much. What do you think? |
Following this thread because I'm trying to setup https://stripe.com/docs/billing/subscriptions/checkout in Cloudflare Workers and bumping into this exact issue. I can't configure Webpack to Not targeting WARNING in ./node_modules/stripe/lib/utils.js 17:9-38
Module not found: Error: Can't resolve 'child_process' in '/<path-to-repo>/node_modules/stripe/lib'
@ ./node_modules/stripe/lib/stripe.js 28:14-32
@ ./src/index.js 12:13-30 But targeting Uncaught ReferenceError: require is not defined
at Object.http (worker.js:5218)
at __webpack_require__ (worker.js:5269)
at Object../node_modules/stripe/lib/StripeResource.js (worker.js:1157)
...etc I would absolutely love a solution for this because it means I don't have to spin up an expensive server just to host my payment integration. My app is completely serverless otherwise. |
Sorry to hijack this issue, but @signalnerve do you mind sharing how you are validating signatures (or more specifically, how you are getting the raw request body)? I get |
+1 I too would love to see this implemented. I'm running up on the same situation, where I'm trying to create a session and I get an error from the Stripe API indicating that it cannot read property "protocol" of undefined. |
apowerful1 has contributed $70.00 to this issue on Rysolv. |
|
I'd love a Cloudflare solution too. @mdingena fyi you can currently do this for free with Netlify's Lambda integration. I followed this guide when implementing donations on reveddit.com. If Stripe worked with workers I would look at moving deployment from Netlify to Cloudflare. The site currently uses Cloudflare DNS and Netlify for deployment. |
+1 Stripe on Cloudflare workers |
An anonymous user has contributed $10.00 to this issue on Rysolv. |
I would like to be able to use Stripe in Deno so +1 to any solution compatible with There is $80 bounty on this, which is great, is there any progress or updates on if/when it might be implemented? |
An anonymous user has contributed $30.00 to this issue on Rysolv. |
+1 for this feature - would love to move some of our workloads off of gcloud functions and onto cloudflare |
Cloudflare is now working on polyfills to support Node libraries in workers! Stripe and Twilio SDKs are first in line and you can vote here on libraries you'd like to be supported. |
An anonymous user has contributed $10.00 to this issue on Rysolv. |
Hey I have been trying to build a stripe sdk that can run on workers.dev, but as @hmnd say Cloudflare is going to start supporting If anyone wants to help to develop and test the repo is: => https://github.com/TrinaryLabs/stripe-workers |
Hey everyone - thanks for your patience on this issue! I have some good news on the Cloudflare Workers front. You should now be able to run on Cloudflare Workers out of the box using the following Stripe client instantiation:
We've put together a template at https://github.com/stripe-samples/stripe-node-cloudflare-worker-template which can be used with You can also use this in Deno as well as any other JS environment which uses Please let us know if you experience any issues or have feedback for the team. Thanks! |
So happy to see this launch! Thanks team and excited to collab on Workers stuff with you all in the future ❤️ |
Hey all, one thing I have not been able to make work (honestly not real sure where to start) is using this with Cloudflare Pages (specifically the Functions feature). This might be an issue that the Cloudflare team needs to resolve? @signalnerve I don't see in the docs a way to specify a Webpack configuration for a Pages build, and without it the Stripe SDK is effectively unusable. (My use-case: single product, only a few pages, static HTML overall with the shopping cart a JS library entirely in the browser, using Stripe to handle the actual purchase point.) |
@saibotsivad you specify a custom a build command. By default it uses |
👋 You can now also use stripe-node in Deno. Here are some resources to get started: With that we should be able to close this issue out. Thanks for the patience! |
@dcr-stripe I'm unable to run the Deno samples. See stripe-samples/stripe-node-deno-samples#1 Should I rather create a new ticket in this repo? AFAICT there is no CI verifying that this library actually works on Deno. |
Done! #1428 |
Not sure if this is related to this, but I'm getting |
I'm trying to setup a Stripe service as a serverless function using the Cloudflare Workers platform.
But the
stripe-node
package seems to depend on Node.js APIs. Is it possible to use a subset ofstripe-node
's functionalities for Cloudflare Workers?Is supporting Cloudlfare Workers something you are interested in? Using Stripe in a no-cold-start serverless environment would be quite lovely.
Would it be possible to extract the business logic that is agnostic to Node.js and expose it to users? So that we can use all kinds of platforms beyond Node.js, such as the Deno or Cloudflare Workers. It could be a new package, e.g.
stripe-js
.Thanks for what you are doing at Stripe, it's such a lovely product.
Related tickets: #871 #773.
The text was updated successfully, but these errors were encountered: