Skip to content

Commit

Permalink
Make it work with node 20 (#4263)
Browse files Browse the repository at this point in the history
Add `--no-experimental-fetch` to node20. This is needed for konnectors
and service compatibility
  • Loading branch information
sblaisot authored Jan 15, 2024
2 parents fc357ee + 9890e17 commit b494654
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions scripts/konnector-nsjail-node-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@ if ! [ -x "${NODE_BIN}" ]; then
exit 1
fi

RLIMIT_AS=4096
NODE_OPTS=""

NODE_VERSION="$(${NODE_BIN} --version)"
if [ "${NODE_VERSION%%.*}" = "v12" ]; then
NODE_VERSION=${NODE_VERSION%%.*}
NODE_VERSION=${NODE_VERSION##v}
if [ ${NODE_VERSION} -ge 20 ]; then
# Node 20 built-in "fetch" instanciate a wasm engine that require more than 10GB of RAM address space
# and nsjail limit memory by limiting the address space so we need to increase it by 10 GB
RLIMIT_AS=14336
elif [ "${NODE_VERSION}" = "12" ]; then
NODE_OPTS="--max-http-header-size=16384 --tls-min-v1.0 --http-parser=legacy"
else
NODE_OPTS=""
fi

if [ -z "${COZY_JOB_ID}" ]; then
Expand Down Expand Up @@ -137,7 +144,7 @@ EOM
nsjail \
--quiet \
--mode o \
--rlimit_as 2048 \
--rlimit_as ${RLIMIT_AS} \
--rlimit_cpu 1000 \
--rlimit_fsize 1024 \
--rlimit_nofile 128 \
Expand Down Expand Up @@ -171,7 +178,7 @@ nsjail \
# nsjail \
# --quiet \
# --chroot /chrootdir \
# --rlimit_as 2048 \
# --rlimit_as ${RLIMIT_AS} \
# --rlimit_cpu 1000 \
# --rlimit_fsize 1024 \
# --rlimit_nofile 128 \
Expand Down

0 comments on commit b494654

Please sign in to comment.