-
Notifications
You must be signed in to change notification settings - Fork 417
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
Do not swallow errors in case npm ls fails without an empty stdout and use spawn for child processes #373
Conversation
Enhance error message Removed deprecated option from README Convert all outstanding changes (yarn and package) Adjusted NPM unit tests Use spawn in any npm commands Use spawn instead of exec Fix unit test description Do not swallow errors in case npm ls fails without a proper stdout
c9548bc
to
b379de9
Compare
Hi @franciscocpg . Could you do me a favor and test if the current master still works properly for you? I switched the packager invocations to use |
hi @HyperBrain A |
Thanks 😏 . Yes I think so, because it runs through the whole npm or yarn processes. There's no need to actually deploy it. |
@HyperBrain I'm unable to run using |
Thanks for the tests 👍 . I commented on the issue with yarn. Maybe the plugin could emit a better error message for that case. |
Was able to test with |
…-on-stdout-empty-with-npm Do not swallow errors in case npm ls fails without an empty stdout and use spawn for child processes
What did you implement:
If
npm ls
fails the plugin tries to analyze stderr for npm errors that can be ignored. If none are found, it will pass stdout toJSON.parse()
.The case that any non-npm error was happening was not handled correctly (e.g. if the stdout maxbuffer size got exceeded by a very big dependency section). The plugin passed the empty stdout to JSON parse and failed there without telling the exact reason for the failure.
Additionally, Node's buffered stdio streams do not work reliably and the
exec
method is not meant to be used for processes that might return data of arbitrary length.How did you implement it:
The packager executables are now executed with
child_process.spawn
which allows for stdio streams of arbitrary length. On execution failure, a proper SpawnError is now thrown that contains the full stdout and stderr streams.Additionally this eliminates the need of the
packExternalModulesMaxBuffer
buffer configuration which has been removed from the README.The implementation should seamlessly work as before.
How can we verify it:
Use a package.json with many dependencies, so that the output of
npm ls
exceeds the max stdout buffer default of 200k with the old serverless-webpack version.It should work with this branch now.
Todos:
Is this ready for review?: YES
Is it a breaking change?: NO