Skip to content

Conversation

@xooolod
Copy link

@xooolod xooolod commented Oct 30, 2024

Pull Request

Issue

  • Changed some methods to match express 5.0 requirements
  • Changed PagesRouter.spec.js (req.query is now a getter)
  • Bumped express to v5

Review and testing required !

Closes: #9353

Approach

  • Changed some methods to match express 5.0 requirements
  • Changed PagesRouter.spec.js (req.query is now a getter)
  • Bumped express from v4 to v5

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)
  • Add security check
  • Add new Parse Error codes to Parse JS SDK

- Changed some methods to match express 5.0 requirements
- Changed PagesRouter.spec.js (req.query is now a getter)
- Bumped express to v5

Review and testing required !

Closing #9353
Please enter the commit message for your changes. Lines starting
@parse-github-assistant
Copy link

Thanks for opening this pull request!

@xooolod xooolod changed the title Express v4 -> v5 migration feat: Express v4 -> v5 migration Oct 30, 2024
// run afterSaveFile trigger
await triggers.maybeRunFileTrigger(triggers.Types.afterSave, fileObject, config, req.auth);
res.status(201);
res.status(201).json(saveResult);
Copy link
Member

Choose a reason for hiding this comment

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

Why are you retuning saveResult directly? The code before your change has only been returning a Location key?

const data = await filesController.getMetadata(filename);
res.status(200);
res.json(data);
res.status(200).json(data);
Copy link
Member

@mtrezza mtrezza Oct 30, 2024

Choose a reason for hiding this comment

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

Are these changes necessary? If not, please revert.

"cors": "2.8.5",
"deepcopy": "2.1.0",
"express": "4.21.0",
"express": "^5.0.0",
Copy link
Member

@mtrezza mtrezza Oct 30, 2024

Choose a reason for hiding this comment

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

Please revert package.json and package-lock.json and then run npm i -E [email protected]

await verifyEmail(req);
expect(goToPage.calls.all()[0].args[1]).toBe(pages.emailVerificationLinkInvalid);
});

Copy link
Member

Choose a reason for hiding this comment

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

Could you please revert these dirty lines

@mtrezza mtrezza changed the title feat: Express v4 -> v5 migration refactor: Upgrade to express 5.0.1 Oct 30, 2024
req.query.locale = 'yo-LO';

const queryWithLocale = { ...req.query, locale: 'yo-LO' };
req = { ...req, query: queryWithLocale };
Copy link
Member

Choose a reason for hiding this comment

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

This looks strange, what are you trying to do there?

Comment on lines -452 to +453
});
Copy link
Member

Choose a reason for hiding this comment

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

... and here?

@mtrezza
Copy link
Member

mtrezza commented Oct 30, 2024

@xooolod Before you submit your PR for review, please run the tests locally to see whether they all pass. This makes it easier for you to spot errors.

@xooolod xooolod closed this by deleting the head repository Nov 4, 2024
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.

Upgrade express from 4 to 5

2 participants