diff --git a/services/clsi/.nvmrc b/services/clsi/.nvmrc
index 5ab50cd8e9..d9f880069d 100644
--- a/services/clsi/.nvmrc
+++ b/services/clsi/.nvmrc
@@ -1 +1 @@
-14.18.3
+16.14.2
diff --git a/services/clsi/Dockerfile b/services/clsi/Dockerfile
index e70a021cdb..c09324ed35 100644
--- a/services/clsi/Dockerfile
+++ b/services/clsi/Dockerfile
@@ -2,7 +2,7 @@
# Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment
-FROM gcr.io/overleaf-ops/node:14.18.3 as base
+FROM node:16.14.2 as base
WORKDIR /overleaf/services/clsi
COPY services/clsi/install_deps.sh /overleaf/services/clsi/
diff --git a/services/clsi/Makefile b/services/clsi/Makefile
index 91f68a766c..876c8fbc62 100644
--- a/services/clsi/Makefile
+++ b/services/clsi/Makefile
@@ -30,7 +30,7 @@ HERE=$(shell pwd)
MONOREPO=$(shell cd ../../ && pwd)
# Run the linting commands in the scope of the monorepo.
# Eslint and prettier (plus some configs) are on the root.
-RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) gcr.io/overleaf-ops/node:14.18.3 npm run --silent
+RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:16.14.2 npm run --silent
format:
$(RUN_LINTING) format
diff --git a/services/clsi/buildscript.txt b/services/clsi/buildscript.txt
index bca2d00bdb..edd1bad3f3 100644
--- a/services/clsi/buildscript.txt
+++ b/services/clsi/buildscript.txt
@@ -5,7 +5,6 @@ clsi
--env-add=ENABLE_PDF_CACHING="true",PDF_CACHING_ENABLE_WORKER_POOL="true"
--env-pass-through=TEXLIVE_IMAGE
--has-custom-cloudbuild=True
---node-image=gcr.io/overleaf-ops/node
---node-version=14.18.3
+--node-version=16.14.2
--public-repo=True
--script-version=4.1.0
diff --git a/services/clsi/install_deps.sh b/services/clsi/install_deps.sh
index bcddc2d8e1..07711b2033 100755
--- a/services/clsi/install_deps.sh
+++ b/services/clsi/install_deps.sh
@@ -8,3 +8,17 @@ apt-get install -y \
ghostscript \
rm -rf /var/lib/apt/lists/*
+
+# Allow ImageMagick to process PDF files. This is for tests only, but since we
+# use the production images for tests, this will apply to production as well.
+patch /etc/ImageMagick-6/policy.xml <
+
+
+-
+
+
+EOF
diff --git a/services/clsi/test/bench/hashbench.js b/services/clsi/test/bench/hashbench.js
index 787a4e2280..652ad39c7d 100644
--- a/services/clsi/test/bench/hashbench.js
+++ b/services/clsi/test/bench/hashbench.js
@@ -28,7 +28,7 @@ function test(hashType, filePath, callback) {
ContentCacheManager.update(dir, filePath, x => {
const t2 = process.hrtime.bigint()
const warm = Number(t2 - t1) / 1e6
- fs.rmdir(dir, { recursive: true }, err => {
+ fs.rm(dir, { recursive: true, force: true }, err => {
if (err) {
return callback(err)
}
diff --git a/services/clsi/test/unit/js/ContentCacheManagerTests.js b/services/clsi/test/unit/js/ContentCacheManagerTests.js
index fc806bc482..bfb7179587 100644
--- a/services/clsi/test/unit/js/ContentCacheManagerTests.js
+++ b/services/clsi/test/unit/js/ContentCacheManagerTests.js
@@ -40,7 +40,7 @@ describe('ContentCacheManager', function () {
})
before(async function () {
- await fs.promises.rmdir(contentDir, { recursive: true })
+ await fs.promises.rm(contentDir, { recursive: true, force: true })
await fs.promises.mkdir(contentDir, { recursive: true })
await fs.promises.mkdir(Path.dirname(pdfPath), { recursive: true })
})