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

Replaced body-parser package with latest express support #1129

Closed
wants to merge 1 commit into from
Closed

Replaced body-parser package with latest express support #1129

wants to merge 1 commit into from

Conversation

MohamedJakkariya
Copy link

Importance of changes

  • body-parser npm package was deprecated with the latest express.js.
  • So no longer it was used instead we can use inbuild express.json() and so on.
  • Mainly, you're example doesn't work. After research, I was found a solution to this. So finally it was working with Stripe CLI and through the dashboard as well.
  • Hopefully, It'll make sense.

**Importance of changes**
1. `body-parser` npm package was deprecated with the latest express.js.
2. So no longer it was used instead we can use inbuild express.json() and so on.
3. Mainly, you're example doesn't work. After research, I was found a solution to this. So finally it was working with Stripe CLI and through the dashboard as well.
4. Hopefully, It'll make sense.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@MohamedJakkariya MohamedJakkariya changed the title Update express.js Replaced body-parser package with latest express support Mar 14, 2021
@remi-stripe remi-stripe self-assigned this Mar 16, 2021
@remi-stripe
Copy link
Contributor

@MohamedJakkariya Thanks for opening the PR! I don't think body-parser is deprecated at the moment and the code example we have in the repo does work as expected While Express 4 has introduced their own version a few years ago the external npm package should just work.

Looking at the PR you seem to have changed body intorawBody amongst other things. Maybe the issue you were encountering wasn't about the example itself but having webhook signatures work in your own environment? This can definitely be tricky with node in general as there are many different ways to do this depending on your setup. There's an issue on the repo with many solutions and you might want to look at it directly: #341

Since the example we have locally is simpler and should work for vanilla installs we're going to keep it as it and close this PR but hopefully you're unblocked. If you have follow-up questions don't hesitated to contact our support team. We also have developers on IRC in #stripe on Freenode!

@MohamedJakkariya MohamedJakkariya deleted the patch-1 branch March 27, 2021 06:45
@MohamedJakkariya
Copy link
Author

But I don't know these examples always not working for me so finally coming with this. If it's working fine then no issues.

@remi-stripe
Copy link
Contributor

@MohamedJakkariya What you have is totally fine if it works for you. We wouldn't update our sample though as it is what works for many developers but as long as you made it work it's great!

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

Successfully merging this pull request may close these issues.

3 participants