From 494bf524b3d0908b973f3170e88c412bca76f298 Mon Sep 17 00:00:00 2001 From: HUAHUAI23 Date: Mon, 12 Aug 2024 09:13:37 +0000 Subject: [PATCH] fix(runtime): Disable type errors in production and fix zombie process collection --- runtimes/nodejs/Dockerfile | 7 +++++-- runtimes/nodejs/src/handler/typings.ts | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/runtimes/nodejs/Dockerfile b/runtimes/nodejs/Dockerfile index 1a2f0ebe29..0129c01bae 100644 --- a/runtimes/nodejs/Dockerfile +++ b/runtimes/nodejs/Dockerfile @@ -1,6 +1,6 @@ FROM node:20.10.0 -RUN apt update && apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev git -y +RUN apt update && apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev git dumb-init -y # RUN npm install npm -g @@ -27,4 +27,7 @@ RUN chown node:node /app/package.json RUN chown node:node /app/package-lock.json USER node -CMD [ "sh", "/app/start.sh" ] \ No newline at end of file + +ENTRYPOINT ["/usr/bin/dumb-init", "--"] + +CMD [ "sh", "/app/start.sh" ] diff --git a/runtimes/nodejs/src/handler/typings.ts b/runtimes/nodejs/src/handler/typings.ts index 74eb1b05f5..5aa9f7fc17 100644 --- a/runtimes/nodejs/src/handler/typings.ts +++ b/runtimes/nodejs/src/handler/typings.ts @@ -102,7 +102,10 @@ async function getThreePartyPackageTypings( data: pkd.declarations, }) } catch (error) { - logger.error(requestId, 'failed to get package typings', error) + if (!Config.isProd) { + logger.error(requestId, 'failed to get package typings', error) + } + return res.send({ code: 1, error: error.toString(),