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:
@@ -64,7 +64,7 @@ function makeBatchRoutingPathFunction(originalUrl, serverURL, publicServerURL) {
|
||||
// Returns a promise for a {response} object.
|
||||
// TODO: pass along auth correctly
|
||||
function handleBatch(router, req) {
|
||||
if (!Array.isArray(req.body.requests)) {
|
||||
if (!Array.isArray(req.body?.requests)) {
|
||||
throw new Parse.Error(Parse.Error.INVALID_JSON, 'requests must be an array');
|
||||
}
|
||||
|
||||
@@ -85,12 +85,12 @@ function handleBatch(router, req) {
|
||||
|
||||
const batch = transactionRetries => {
|
||||
let initialPromise = Promise.resolve();
|
||||
if (req.body.transaction === true) {
|
||||
if (req.body?.transaction === true) {
|
||||
initialPromise = req.config.database.createTransactionalSession();
|
||||
}
|
||||
|
||||
return initialPromise.then(() => {
|
||||
const promises = req.body.requests.map(restRequest => {
|
||||
const promises = req.body?.requests.map(restRequest => {
|
||||
const routablePath = makeRoutablePath(restRequest.path);
|
||||
|
||||
// Construct a request that we can send to a handler
|
||||
@@ -113,7 +113,7 @@ function handleBatch(router, req) {
|
||||
|
||||
return Promise.all(promises)
|
||||
.then(results => {
|
||||
if (req.body.transaction === true) {
|
||||
if (req.body?.transaction === true) {
|
||||
if (results.find(result => typeof result.error === 'object')) {
|
||||
return req.config.database.abortTransactionalSession().then(() => {
|
||||
return Promise.reject({ response: results });
|
||||
|
||||
Reference in New Issue
Block a user