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: moleculer crash if file size is too large #313

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0x0a0d
Copy link
Contributor

@0x0a0d 0x0a0d commented Jul 27, 2022

No description provided.

@@ -158,7 +158,11 @@ class Alias {
if (_.isFunction(busboyOptions.onFileSizeLimit)) {
busboyOptions.onFileSizeLimit.call(this.service, file, busboy);
}
file.destroy(new PayloadTooLarge({ fieldname, filename, encoding, mimetype }));
file.destroy();
busboy.emit("error", new PayloadTooLarge({ fieldname, filename, encoding, mimetype }));
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 explain the changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

without this pull, below example will crash application
https://stackblitz.com/edit/node-3az7uh?file=index.js

Copy link
Member

@icebob icebob left a comment

Choose a reason for hiding this comment

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

I've check it but I think it doesn't work well. It doesn't throw error, the response doesn't go back, but the action handler is called.

@0x0a0d
Copy link
Contributor Author

0x0a0d commented Aug 13, 2022

i've created this repo
bug can not reproduce on moleculer-web source

https://github.com/0x0a0d/issue-313-moleculer-web

@icebob
Copy link
Member

icebob commented Aug 15, 2022

I could reproduce the issue but this PR doesn't fix it correctly.

@0x0a0d
Copy link
Contributor Author

0x0a0d commented Aug 15, 2022

PR keeps moleucler to not crash, the real problem I think is due to busybox, but I don't have time to look closely.

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