You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before anything, I just want to say that this project is gold. It's basically an open-source alternative to https://syncinc.so/. When i read in the README:
Note: this is experimental. There are no guarantees that it will be supported in the future.
I just hope that this project will continue to live on!
Feature request
Is your feature request related to a problem? Please describe.
This repo instantiates a server using fastify. To use this code, one needs to deploy a separate server, e.g. on https://fly.io. It maybe happens that the user already has a server with existing API endpoints, and just wants to add another /webhook (or with another name!) endpoint, and use the behind-the-scenes logic from this repo.
Currently, it's hard to use this repo's code in an existing server codebase.
Describe the solution you'd like
I propose to expose a npm package that would be stripe-sync-engine as a library.
Basically, it would expose one webhookHandler function, which would more or less contain this code and all related dependencies.
Then, the actual server's webhook in src/routes/webhooks.ts can be as simple as:
import{webhookHandler}from'@supabase/stripe-sync-engine';exportdefaultasyncfunctionroutes(fastify: FastifyInstance){fastify.post('/webhooks',{handler: async(request,reply)=>{awaitwebhookHandler({body: request.bodyas{raw: Buffer},stripeSig: request.headers['stripe-signature'],stripeWebhookSecret: config.STRIPE_WEBHOOK_SECRET,// maybe some other options});returnreply.send({received: true})});}
And then it should be easy to use webhookHandler with other backend frameworks (Express, Next.js...)
Describe alternatives you've considered
There's always the possibility to fork, but...
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
The problem is not so much to have the /webhook endpoint on the same URL (which a reverse proxy solves), but really to avoid deploying a separate server (which comes with additional costs & maintenance).
Thanks for the kind words, @AmauryM - always nice hearing positive feedback.
I think we can probably extract out the logic from the API routes. I'm not entirely sure how yet but something we can look at. We did something similar with postgres-meta.
Before anything, I just want to say that this project is gold. It's basically an open-source alternative to https://syncinc.so/. When i read in the README:
I just hope that this project will continue to live on!
Feature request
Is your feature request related to a problem? Please describe.
This repo instantiates a server using fastify. To use this code, one needs to deploy a separate server, e.g. on https://fly.io. It maybe happens that the user already has a server with existing API endpoints, and just wants to add another
/webhook
(or with another name!) endpoint, and use the behind-the-scenes logic from this repo.Currently, it's hard to use this repo's code in an existing server codebase.
Describe the solution you'd like
I propose to expose a npm package that would be
stripe-sync-engine
as a library.Basically, it would expose one
webhookHandler
function, which would more or less contain this code and all related dependencies.Then, the actual server's webhook in
src/routes/webhooks.ts
can be as simple as:And then it should be easy to use
webhookHandler
with other backend frameworks (Express, Next.js...)Describe alternatives you've considered
There's always the possibility to fork, but...
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: