fix(functions): migrate imagemagick sample to sharp and improve test stability#4288
Conversation
…stability - Replaced 'gm' with 'sharp' for image blurring to fix EPIPE errors. - Fixed temporary file deletion to prevent memory leaks in the blurring function. - Refactored the test suite to use try...finally, ensuring the Functions Framework process is always killed to release ports (fixes EADDRINUSE). - Improved test error logging for easier debugging.
There was a problem hiding this comment.
Code Review
This pull request migrates the image blurring function from ImageMagick (using the gm library) to the sharp library. The changes include updating the dependencies in package.json, refactoring the core logic in index.js to handle temporary files with sharp, and enhancing the test suite with better error handling. The review feedback correctly identifies that the engines field in package.json must be updated to support sharp's Node.js requirements. Additionally, there are several recommendations to improve code quality by removing dead code (commented-out lines), fixing inconsistent language in comments, and ensuring consistent async/await usage during file cleanup.
38f6423 to
5d0e356
Compare
amcolin
left a comment
There was a problem hiding this comment.
Changes look solid to me.
Description
Fixes Internal: b/503436089
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.
Checklist
npm test(see Testing)npm run lint(see Style)GoogleCloudPlatform/nodejs-docs-samples. Not a fork.