feat: Upgrade to express 5.0.1 (#9530)

BREAKING CHANGE: This upgrades the internally used Express framework from version 4 to 5, which may be a breaking change. If Parse Server is set up to be mounted on an Express application, we recommend to also use version 5 of the Express framework to avoid any compatibility issues. Note that even if there are no issues after upgrading, future releases of Parse Server may introduce issues if Parse Server internally relies on Express 5-specific features which are unsupported by the Express version on which it is mounted. See the Express [migration guide](https://expressjs.com/en/guide/migrating-5.html) and [release announcement](https://expressjs.com/2024/10/15/v5-release.html#breaking-changes) for more info.
This commit is contained in:
Colin Ulin
2025-03-03 16:11:42 -05:00
committed by GitHub
parent cc8dad8fa1
commit e0480dfa8d
26 changed files with 995 additions and 401 deletions

View File

@@ -68,7 +68,7 @@ export class UsersRouter extends ClassesRouter {
_authenticateUserFromRequest(req) {
return new Promise((resolve, reject) => {
// Use query parameters instead if provided in url
let payload = req.body;
let payload = req.body || {};
if (
(!payload.username && req.query && req.query.username) ||
(!payload.email && req.query && req.query.email)
@@ -219,7 +219,7 @@ export class UsersRouter extends ClassesRouter {
req.auth,
'_User',
{ objectId: user.objectId },
req.body,
req.body || {},
user,
req.info.clientSDK,
req.info.context
@@ -336,7 +336,7 @@ export class UsersRouter extends ClassesRouter {
throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, 'master key is required');
}
const userId = req.body.userId || req.query.userId;
const userId = req.body?.userId || req.query.userId;
if (!userId) {
throw new Parse.Error(
Parse.Error.INVALID_VALUE,
@@ -438,8 +438,9 @@ export class UsersRouter extends ClassesRouter {
async handleResetRequest(req) {
this._throwOnBadEmailConfig(req);
let email = req.body.email;
const token = req.body.token;
let email = req.body?.email;
const token = req.body?.token;
if (!email && !token) {
throw new Parse.Error(Parse.Error.EMAIL_MISSING, 'you must provide an email');
}
@@ -480,7 +481,7 @@ export class UsersRouter extends ClassesRouter {
async handleVerificationEmailRequest(req) {
this._throwOnBadEmailConfig(req);
const { email } = req.body;
const { email } = req.body || {};
if (!email) {
throw new Parse.Error(Parse.Error.EMAIL_MISSING, 'you must provide an email');
}
@@ -513,7 +514,7 @@ export class UsersRouter extends ClassesRouter {
}
async handleChallenge(req) {
const { username, email, password, authData, challengeData } = req.body;
const { username, email, password, authData, challengeData } = req.body || {};
// if username or email provided with password try to authenticate the user by username
let user;