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

Stripe not compatible #1

Open
tannermeade opened this issue Oct 28, 2022 · 3 comments
Open

Stripe not compatible #1

tannermeade opened this issue Oct 28, 2022 · 3 comments

Comments

@tannermeade
Copy link

tannermeade commented Oct 28, 2022

Stripe is not compatible with this proxy because it reformats the raw body in a way that breaks stripe validating the signature. The stripe SDK uses the signed signature in the header and the raw body itself in the validation process (the docs specifically say json parsing the raw body will break it).

So this web proxy needs to not take responsibility for parsing the body but leave that responsibility to the cloud function.

@tannermeade
Copy link
Author

This can be fixed by replacing the data-parser on line 10 with the below:

app.use('/v1/execute', function (req, res, next) {
    var data = '';
    req.setEncoding('utf8');
    req.on('data', function (chunk) {
        data += chunk;
    });

    req.on('end', function () {
        req.body = data;
        next();
    });
}, async (req, res) => { //....

@Meldiron
Copy link
Owner

Meldiron commented Nov 1, 2022

@tannermeade Thanks for this 🤝 Would you mind opening a pull request?

@tannermeade
Copy link
Author

tannermeade commented Feb 12, 2023

@tannermeade Thanks for this 🤝 Would you mind opening a pull request?

Didn't end up making a PR because I continued to run into issues using it as a proxy for stripe webhooks. Even after the changes it still didn't work for the refund events because the character count was too large among other issues. The standard fixes weren't working, so I recreated this proxy in dart and now the stripe webhook proxy is working well.

I could make a PR to overwrite the nodejs project with the dart one, but not sure if that is what you'd want.

EDIT: The char count issue is actually related to appwrite, not the proxy.

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

No branches or pull requests

2 participants