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

fix(server/previews): fix factory method which require getStreams as parameter #3157

Merged
merged 3 commits into from
Sep 28, 2024

Conversation

iainsproat
Copy link
Contributor

@iainsproat iainsproat commented Sep 27, 2024

Description & motivation

We were receiving a higher than normal number of 5XX errors from the /preview/* endpoints on the server.

A 500 error can be recreated by requesting a url parameter of ?postprocess=og.

Screenshot 2024-09-27 at 15 46 55

This was due to an invalid factory parameter being passed to the method.

Screenshot 2024-09-27 at 14 30 22

Changes:

  • convert packages/server/modules/preview/index.js and packages/server/modules/previews/ogImage.js to typescript, this aids in catching this category of type mismatch error.
  • replace getObject with getStream, as the latter is required by the sendObjectPreviewFactory method.
  • fix type to allow the SendObjectPreview parameter for angle to be undefined

To-do before merge:

Screenshots:

Validation of changes:

It now works after the fix:

Screenshot 2024-09-27 at 15 57 33

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

References

@@ -50,7 +50,7 @@ exports.init = (app, isInitial) => {
getPreviewImage: getPreviewImageFactory({ db })
})
const sendObjectPreview = sendObjectPreviewFactory({
getObject,
getStream,
Copy link
Contributor Author

@iainsproat iainsproat Sep 27, 2024

Choose a reason for hiding this comment

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

This was the culprit for the 5XX errors.

@iainsproat iainsproat marked this pull request as ready for review September 27, 2024 15:00
@iainsproat iainsproat changed the title fix(server/previews): fix factory to use getStreams as required fix(server/previews): fix factory method which require getStreams as parameter Sep 27, 2024
@gjedlicska gjedlicska merged commit 92712a3 into main Sep 28, 2024
23 of 25 checks passed
@gjedlicska gjedlicska deleted the iain/debug-preview branch September 28, 2024 13:00
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.

2 participants