From a4ea9d4fb3fcde95f559268431e2d41651160013 Mon Sep 17 00:00:00 2001 From: Mark Chapman Date: Tue, 1 Sep 2026 14:33:45 +0000 Subject: [PATCH] fix: Patch imagemagick-stream to stop crashing on Node 24 imagemagick-stream@4.1.1's error handler calls util.isError(), which was removed from Node.js core. On Node 24 this throws "TypeError: isError is not a function" every time ImageMagick emits any error output, masking the real underlying failure and crashing instead of emitting a normal 'error' event on the stream. The package has been unmaintained since 2018, so patch it in place via patch-package (already used in this repo for liftup). Fixes plait PLAIT-BACKEND-947 --- patches/imagemagick-stream+4.1.1.patch | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 patches/imagemagick-stream+4.1.1.patch diff --git a/patches/imagemagick-stream+4.1.1.patch b/patches/imagemagick-stream+4.1.1.patch new file mode 100644 index 0000000..0f39757 --- /dev/null +++ b/patches/imagemagick-stream+4.1.1.patch @@ -0,0 +1,15 @@ +diff --git a/node_modules/imagemagick-stream/index.js b/node_modules/imagemagick-stream/index.js +index 9e036c4..d809df9 100644 +--- a/node_modules/imagemagick-stream/index.js ++++ b/node_modules/imagemagick-stream/index.js +@@ -1,7 +1,9 @@ + "use strict"; + + const spawn = require('child_process').spawn; +-const isError = require('util').isError; ++// util.isError was removed from Node.js core (present in Node <= ~22, gone by Node 24) - reimplement ++// locally rather than relying on it, since the upstream package has been unmaintained since 2018. ++const isError = (val) => Object.prototype.toString.call(val) === '[object Error]'; + const Duplexify = require('duplexify'); + const fs = require('fs'); +