Skip to content

chore: replace deprecated body-parser with express built-in middleware#38235

Open
shouryapratap132006 wants to merge 1 commit intoRocketChat:developfrom
shouryapratap132006:fix/body-parser-urlencode-deprecation
Open

chore: replace deprecated body-parser with express built-in middleware#38235
shouryapratap132006 wants to merge 1 commit intoRocketChat:developfrom
shouryapratap132006:fix/body-parser-urlencode-deprecation

Conversation

@shouryapratap132006
Copy link

@shouryapratap132006 shouryapratap132006 commented Jan 17, 2026

Proposed changes

This PR removes the deprecated body-parser middleware usage and replaces it with Express built-in middleware (express.json() and express.urlencoded()).

Express has provided native body parsing since v4.16, so this change:
Eliminates deprecation warnings
Removes an unnecessary dependency
Preserves existing behavior (extended: false)
No functional or API behavior changes are introduced.

🧩 Issue(s)

N/A — maintenance / deprecation cleanup
(No existing issue required)

🧪 Steps to test or reproduce

Start Rocket.Chat locally:
yarn dsv

Verify server starts without body-parser deprecation warnings
Confirm Apps API routes still work:
/api/apps/private/:appId/:hash
/api/apps/public/:appId

💬 Further comments
This change intentionally avoids any behavioural changes and strictly replaces deprecated middleware with Express-native alternatives. The default extended: false option is preserved to match previous behaviour.

Summary by CodeRabbit

  • Refactor
    • Switched internal request parsing to use platform-native parsers; no changes to endpoints, public interfaces, or user-facing behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@shouryapratap132006 shouryapratap132006 requested a review from a team as a code owner January 17, 2026 19:59
@changeset-bot
Copy link

changeset-bot bot commented Jan 17, 2026

⚠️ No Changeset found

Latest commit: 2d4b0c5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 17, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@CLAassistant
Copy link

CLAassistant commented Jan 17, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Walkthrough

This change removes the body-parser dependency from the router and replaces it with Express's built-in express.urlencoded({ extended: false }) and express.json() on private and public API routes, preserving routing and exported signatures. (<=50 words)

Changes

Cohort / File(s) Summary
Middleware Migration
apps/meteor/app/apps/server/bridges/router.ts
Removed body-parser import; replaced bodyParser.urlencoded() and bodyParser.json() with express.urlencoded({ extended: false }) and express.json() on the same routes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

stat: QA assured

Suggested reviewers

  • julio-rocketchat

Poem

🐰 I hopped where parsers used to be,
Body-parser waved goodbye to me.
Express now parses, light and spry,
Routes unchanged — I wink an eye. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and clearly describes the main change: replacing deprecated body-parser middleware with Express built-in middleware, which aligns perfectly with the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@shouryapratap132006 shouryapratap132006 force-pushed the fix/body-parser-urlencode-deprecation branch from 75e38c4 to 4f050fe Compare January 18, 2026 04:51
@shouryapratap132006
Copy link
Author

Hi maintainers ,

The CLA issue has been resolved and all automated checks are now passing.
This PR is a non-functional refactor replacing deprecated body-parser usage with Express built-in middleware.

Could someone please review and add the stat: QA assured label if everything looks good?

Thanks for your time!

@d-gubert d-gubert force-pushed the fix/body-parser-urlencode-deprecation branch from 4f050fe to 2d4b0c5 Compare January 22, 2026 14:24
@KevLehman KevLehman added the contrib: valid A valid contribution where maintainers will review based on priority label Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contrib: valid A valid contribution where maintainers will review based on priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants