diff --git a/README.md b/README.md index c9500f2..8dd3524 100755 --- a/README.md +++ b/README.md @@ -21,12 +21,7 @@ You can update the configuration file or set values to the corresponding environ - `KAFKA_UPDATE_SUBMISSION_TOPIC` The update submission topic from which the app consumes events - `SUBMISSION_API_URL` The Submission API URL - `SUBMISSION_TIMEOUT` The Submission API timeout -- `DB_POOL_SIZE` Pool size of database server, default to be 10 -- `DB_SERVER` legacy database server, e.g 'informixoltp_tcp' -- `DB_NAME` legacy database name, e.g 'tcs_catalog' -- `DB_ID_NAME` legacy CommonOLTP database name, e.g 'common_oltp' -- `DB_HOST` legacy database host, e.g 'informix' -- `DB_SERVICE` legacy database service, e.g 'sqlexec' +- `DB_NAME` legacy database name 'dbname@db_server_name' - `DB_USERNAME` database username - `DB_PASSWORD` database password - `ID_SEQ_UPLOAD` upload database sequence diff --git a/build.sh b/build.sh index c48fefa..5daee15 100755 --- a/build.sh +++ b/build.sh @@ -46,7 +46,7 @@ echo "================================" echo "env set" echo "initiating test" echo "================================" -#docker-compose -f ecs-docker-compose.yml up --build lsp-app-test +docker-compose -f ecs-docker-compose.yml up --build lsp-app-test echo "================================" echo "test completed" echo "================================" diff --git a/config/default.js b/config/default.js index 0600ed8..664841c 100755 --- a/config/default.js +++ b/config/default.js @@ -4,8 +4,6 @@ module.exports = { LOG_LEVEL: process.env.LOG_LEVEL || 'debug', - KAFKA_CONCURRENCY: process.env.KAFKA_CONCURRENCY ? Number(process.env.KAFKA_CONCURRENCY) : 1, - // The client group ID for committing and fetching offsets. // All clients sharing the same group ID belong to the same group. KAFKA_GROUP_ID: process.env.KAFKA_GROUP_ID || 'tc-submission-legacy-processor', @@ -19,8 +17,6 @@ module.exports = { // The client cert key, can be (1) the path to the cert key file, or (2) the cert key content KAFKA_CLIENT_CERT_KEY: process.env.KAFKA_CLIENT_CERT_KEY || './docker/kafka/kafka-ssl/client.key', - KAFKA_AGGREGATE_SUBMISSION_TOPIC: process.env.KAFKA_AGGREGATE_SUBMISSION_TOPIC || 'submission.notification.aggregate', - // The topic from which the app consumes events KAFKA_NEW_SUBMISSION_TOPIC: process.env.KAFKA_NEW_SUBMISSION_TOPIC || 'submission.notification.create', @@ -39,29 +35,8 @@ module.exports = { // payload.types PAYLOAD_TYPES: process.env.PAYLOAD_TYPES || 'bcf2b43b-20df-44d1-afd3-7fc9798dfcae', - // The Informix db pool size - DB_POOL_SIZE: process.env.DB_POOL_SIZE ? Number(process.env.DB_POOL_SIZE) : 10, - - // The Informix Server Name - DB_SERVER: process.env.DB_SERVER || 'informixoltp_tcp', - - DB_PORT: process.env.DB_PORT || '2020', - - DB_PROTOCOL: process.env.DB_PROTOCOL || 'onsoctcp', - - DB_LOCALE: process.env.DB_LOCALE || 'en_US.57372', - // The Informix Database Name - DB_NAME: process.env.DB_NAME || 'tcs_catalog', - - // The CommonOLTP Database Name - DB_ID_NAME: process.env.DB_ID_NAME || 'common_oltp', - - // The Informix Host - DB_HOST: process.env.DB_HOST || 'informix', - - // The Informix Service - DB_SERVICE: process.env.DB_SERVICE || 'sqlexec', + DB_NAME: process.env.DB_NAME || 'tcs_catalog@informixoltp_tcp', // The Informix Database Username DB_USERNAME: process.env.DB_USERNAME || 'informix', @@ -90,4 +65,4 @@ module.exports = { CHALLENGE_INFO_API: process.env.CHALLENGE_INFO_API || 'http://mock-api-host:3000/challenges?filter=id={cid}', // {cid} gets replaced with challenge id MM_CHALLENGE_SUBTRACK: process.env.MM_CHALLENGE_SUBTRACK || 'MARATHON_MATCH, DEVELOP_MARATHON_MATCH' -}; +} diff --git a/config/production.js b/config/production.js index cfd944e..571cccd 100755 --- a/config/production.js +++ b/config/production.js @@ -36,7 +36,7 @@ module.exports = { PAYLOAD_TYPES: process.env.PAYLOAD_TYPES || 'bcf2b43b-20df-44d1-afd3-7fc9798dfcae', // The Informix Database Name - DB_NAME: process.env.DB_NAME || 'tcs_catalog', + DB_NAME: process.env.DB_NAME || 'tcs_catalog@informixoltp_tcp', // The Informix Database Username DB_USERNAME: process.env.DB_USERNAME || 'informix', diff --git a/config/staging.js b/config/staging.js index 71e6f2a..7c6e1a4 100755 --- a/config/staging.js +++ b/config/staging.js @@ -36,7 +36,7 @@ module.exports = { PAYLOAD_TYPES: process.env.PAYLOAD_TYPES || 'bcf2b43b-20df-44d1-afd3-7fc9798dfcae', // The Informix Database Name - DB_NAME: process.env.DB_NAME || 'tcs_catalog', + DB_NAME: process.env.DB_NAME || 'tcs_catalog@informixoltp_tcp', // The Informix Database Username DB_USERNAME: process.env.DB_USERNAME || 'informix', diff --git a/config/test.js b/config/test.js index eea8cd6..4faa9b1 100755 --- a/config/test.js +++ b/config/test.js @@ -38,7 +38,7 @@ module.exports = { PAYLOAD_TYPES: process.env.PAYLOAD_TYPES || 'bcf2b43b-20df-44d1-afd3-7fc9798dfcae', // The Informix Database Name - DB_NAME: 'tcs_catalog', + DB_NAME: 'tcs_catalog@informixoltp_tcp', // The Informix Database Username DB_USERNAME: 'informix', diff --git a/docker/legacy-submission-processor/lspDockerfile b/docker/legacy-submission-processor/lspDockerfile index 8983cb5..87f9a3c 100644 --- a/docker/legacy-submission-processor/lspDockerfile +++ b/docker/legacy-submission-processor/lspDockerfile @@ -1,4 +1,4 @@ -FROM appiriodevops/tc-database-scripts:base +FROM ibmcom/informix-innovator-c:12.10.FC11IE ARG servername=informix ARG port=2021 @@ -7,18 +7,21 @@ USER root RUN mkdir /app WORKDIR /home/informix -RUN sed -i '/jessie-updates/d' /etc/apt/sources.list -RUN apt-get -qq update && apt-get -qq install -y \ - wget gcc g++ make xz-utils python2.7 git +RUN apt-get update -qq && apt-get -qq install -y \ + wget gcc g++ make xz-utils python2.7 git curl RUN wget -q -O node8.tar.xz https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.xz \ && tar xfJ node8.tar.xz && rm -rf node8.tar.xz - ENV SERVERNAME=$servername ENV SERVERPORT=$port -ENV INFORMIXDIR /opt/IBM/informix +COPY docker/legacy-submission-processor/esql /opt/ibm/informix/bin/ +RUN chmod +x /opt/ibm/informix/bin/esql +RUN echo "informixoltp_tcp onsoctcp $SERVERNAME sqlexec" \ + > /opt/ibm/informix/etc/sqlhosts.informixoltp_tcp + +ENV INFORMIXDIR /opt/ibm/informix ENV INFORMIX_HOME /home/informix ENV INFORMIXSERVER informixoltp_tcp ENV INFORMIXTERM terminfo @@ -26,19 +29,15 @@ ENV CLIENT_LOCALE=en_US.utf8 ENV DB_LOCALE=en_US.utf8 ENV DBDATE Y4MD- ENV DBDELIMITER "|" - -COPY docker/legacy-submission-processor/esql ${INFORMIXDIR}/bin/ -RUN chmod +x ${INFORMIXDIR}/bin/esql -RUN echo "informixoltp_tcp onsoctcp ${SERVERNAME:-informix} sqlexec" \ - > ${INFORMIXDIR}/etc/sqlhosts.informixoltp_tcp -RUN echo "sqlexec 2021/tcp" >> /etc/services -RUN rm /usr/bin/python && ln -s /usr/bin/python2.7 /usr/bin/python ENV PATH /home/informix/node-v8.11.3-linux-x64/bin:${INFORMIXDIR}/bin:${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql:${PATH} -ENV LD_LIBRARY_PATH ${INFORMIXDIR}/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/tools:${INFORMIXDIR}/lib/cli -ENV INFORMIXSQLHOSTS ${INFORMIXDIR}/etc/sqlhosts.informixoltp_tcp +ENV LD_LIBRARY_PATH ${INFORMIXDIR}/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/tools +ENV INFORMIXSQLHOSTS /opt/ibm/informix/etc/sqlhosts.informixoltp_tcp ENV USER root ENV LICENSE accept +RUN ln -s /usr/bin/python2.7 /usr/bin/python +RUN echo "sqlexec $SERVERPORT/tcp" >> /etc/services + WORKDIR /app COPY . . RUN npm --unsafe-perm install diff --git a/index.js b/index.js index 85d38dc..9e5c6e3 100755 --- a/index.js +++ b/index.js @@ -1,15 +1,15 @@ /** * The main entry of the application. */ -require('legacy-processor-module/bootstrap'); +require('legacy-processor-module/bootstrap') -const config = require('config'); -const KafkaConsumer = require('legacy-processor-module/KafkaConsumer'); +const config = require('config') +const KafkaConsumer = require('legacy-processor-module/KafkaConsumer') -const SubmissionService = require('./src/services/SubmissionService'); +const SubmissionService = require('./src/services/SubmissionService') -const consumer = KafkaConsumer.startConsumer(SubmissionService, [config.KAFKA_AGGREGATE_SUBMISSION_TOPIC]); +const consumer = KafkaConsumer.startConsumer(SubmissionService, [config.KAFKA_NEW_SUBMISSION_TOPIC, config.KAFKA_UPDATE_SUBMISSION_TOPIC]) if (process.env.NODE_ENV === 'test') { - module.exports = consumer; + module.exports = consumer } diff --git a/package-lock.json b/package-lock.json index 1b4ad62..5a655af 100755 --- a/package-lock.json +++ b/package-lock.json @@ -206,11 +206,6 @@ "@types/mime": "2.0.0" } }, - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, "accepts": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", @@ -231,11 +226,6 @@ "uri-js": "4.2.2" } }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -245,20 +235,6 @@ "color-convert": "1.9.3" } }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" - }, - "are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.6" - } - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -392,28 +368,11 @@ "protocol-buffers-schema": "3.3.2" } }, - "binary": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", - "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", - "requires": { - "buffers": "0.1.1", - "chainsaw": "0.1.0" - } - }, "bindings": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.1.tgz", "integrity": "sha512-i47mqjF9UbjxJhxGf+pZ6kSxrnI3wBLlnGI2ArWJ4r0VrvDS7ZYXkprq/pLaBWYq4GM0r4zdHY+NNRqEMU7uew==" }, - "block-stream": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", - "requires": { - "inherits": "2.0.3" - } - }, "bluebird": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", @@ -476,11 +435,6 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, - "buffers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", - "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=" - }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -492,7 +446,7 @@ "integrity": "sha1-8VDw9nSKvdcq6uhPBEA74u8RN5c=", "requires": { "dtrace-provider": "0.8.7", - "moment": "2.24.0", + "moment": "2.22.2", "mv": "2.1.1", "safe-json-stringify": "1.2.0" } @@ -507,14 +461,6 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, - "chainsaw": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", - "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", - "requires": { - "traverse": "0.3.9" - } - }, "chalk": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", @@ -541,11 +487,6 @@ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "dev": true }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" - }, "codependency": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/codependency/-/codependency-0.1.4.tgz", @@ -618,11 +559,6 @@ "resolved": "https://registry.npmjs.org/connection-parse/-/connection-parse-0.0.7.tgz", "integrity": "sha1-GOcxiqsGppkmc3KxDFIm0locmmk=" }, - "console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" - }, "content-disposition": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", @@ -794,11 +730,6 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, - "delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" - }, "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", @@ -1455,18 +1386,8 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "fstream": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "requires": { - "graceful-fs": "4.1.15", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.4.5" - } + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "functional-red-black-tree": { "version": "1.0.1", @@ -1474,49 +1395,6 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, - "gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "requires": { - "aproba": "1.2.0", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.3" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "1.0.1" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "2.1.1" - } - } - } - }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -1529,6 +1407,7 @@ "version": "6.0.4", "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "optional": true, "requires": { "inflight": "1.0.6", "inherits": "2.0.3", @@ -1574,11 +1453,6 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" - }, "hashring": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/hashring/-/hashring-3.2.0.tgz", @@ -1662,18 +1536,6 @@ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==" }, - "ifxnjs": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/ifxnjs/-/ifxnjs-8.0.1.tgz", - "integrity": "sha1-8v8ywEXDZ4Hkqf4PVKMWUwhYOwo=", - "requires": { - "bindings": "1.3.1", - "fstream": "1.0.12", - "nan": "2.11.1", - "node-gyp": "3.8.0", - "unzip": "0.1.11" - } - }, "import-fresh": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.0.0.tgz", @@ -1722,6 +1584,15 @@ "wrappy": "1.0.2" } }, + "informix": { + "version": "github:coderReview/node-informix#b5015f70686a6739478923e446f6052cc5cc857e", + "requires": { + "bindings": "1.3.1", + "debug": "3.1.0", + "nan": "2.11.1", + "uuid": "3.3.2" + } + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -1767,7 +1638,8 @@ "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true }, "is-promise": { "version": "2.1.0", @@ -1796,7 +1668,8 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, "isstream": { "version": "0.1.2", @@ -1999,7 +1872,7 @@ } }, "legacy-processor-module": { - "version": "git+https://github.com/topcoder-platform/legacy-processor-module.git#e4c2f1fa092a8583e6cbbe8796d28002f373caa6" + "version": "git+https://github.com/topcoder-platform/legacy-processor-module.git#a2a4fd63f6a6e9c85bf015efb4850afb9cb85a15" }, "levn": { "version": "0.3.0", @@ -2136,38 +2009,6 @@ "very-fast-args": "1.1.0" } }, - "match-stream": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/match-stream/-/match-stream-0.0.2.tgz", - "integrity": "sha1-mesFAJOzTf+t5CG5rAtBCpz6F88=", - "requires": { - "buffers": "0.1.1", - "readable-stream": "1.0.34" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - } - } - }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -2281,9 +2122,10 @@ "integrity": "sha1-EUyUlnPiqKNenTV4hSeqN7Z52is=" }, "moment": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=", + "optional": true }, "ms": { "version": "2.0.0", @@ -2328,11 +2170,6 @@ "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz", "integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==" }, - "natives": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.6.tgz", - "integrity": "sha512-6+TDFewD4yxY14ptjKaS63GVdtKiES1pTPyxn9Jb0rBqPMZ7VcCiooEhPNsr+mqHtMGxa/5c/HhcC4uPEUw/nA==" - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -2381,53 +2218,6 @@ "wrr-pool": "1.1.4" } }, - "node-gyp": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", - "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", - "requires": { - "fstream": "1.0.12", - "glob": "7.1.4", - "graceful-fs": "4.1.15", - "mkdirp": "0.5.1", - "nopt": "3.0.6", - "npmlog": "4.1.2", - "osenv": "0.1.5", - "request": "2.88.0", - "rimraf": "2.4.5", - "semver": "5.3.0", - "tar": "2.2.2", - "which": "1.3.1" - }, - "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "semver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" - } - } - }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "requires": { - "abbrev": "1.1.1" - } - }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -2439,22 +2229,6 @@ "validate-npm-package-license": "3.0.4" } }, - "npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "requires": { - "are-we-there-yet": "1.1.5", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" - }, "nyc": { "version": "12.0.2", "resolved": "https://registry.npmjs.org/nyc/-/nyc-12.0.2.tgz", @@ -4513,11 +4287,6 @@ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -4562,29 +4331,11 @@ "wordwrap": "1.0.0" } }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" - }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" - }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" - } - }, - "over": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/over/-/over-0.0.5.tgz", - "integrity": "sha1-8phS5w/X4l82DgE6jsRMgq7bVwg=" + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true }, "p-limit": { "version": "1.3.0", @@ -4705,50 +4456,11 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" }, - "pullstream": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/pullstream/-/pullstream-0.4.1.tgz", - "integrity": "sha1-1vs79a7Wl+gxFQ6xACwlo/iuExQ=", - "requires": { - "over": "0.0.5", - "readable-stream": "1.0.34", - "setimmediate": "1.0.5", - "slice-stream": "1.0.0" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - } - } - }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, - "q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" - }, "qs": { "version": "6.6.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.6.0.tgz", @@ -4873,6 +4585,7 @@ "version": "2.4.5", "resolved": "http://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", + "optional": true, "requires": { "glob": "6.0.4" } @@ -4962,16 +4675,6 @@ "send": "0.16.2" } }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" - }, "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", @@ -5054,44 +4757,14 @@ "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true }, "simple-lru-cache": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/simple-lru-cache/-/simple-lru-cache-0.0.2.tgz", "integrity": "sha1-1ZzDoZPBpdAyD4Tucy9uRxPlEd0=" }, - "slice-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slice-stream/-/slice-stream-1.0.0.tgz", - "integrity": "sha1-WzO9ZvATsaf4ZGCwPUY97DmtPqA=", - "requires": { - "readable-stream": "1.0.34" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - } - } - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -5172,6 +4845,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, "requires": { "is-fullwidth-code-point": "2.0.0", "strip-ansi": "4.0.0" @@ -5189,6 +4863,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, "requires": { "ansi-regex": "3.0.0" }, @@ -5196,7 +4871,8 @@ "ansi-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true } } }, @@ -5237,16 +4913,6 @@ "has-flag": "3.0.0" } }, - "tar": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", - "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", - "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.12", - "inherits": "2.0.3" - } - }, "tc-core-library-js": { "version": "github:appirio-tech/tc-core-library-js#d16413db30b1eed21c0cf426e185bedb2329ddab", "requires": { @@ -5354,11 +5020,6 @@ } } }, - "traverse": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", - "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=" - }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", @@ -5407,61 +5068,6 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, - "unzip": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/unzip/-/unzip-0.1.11.tgz", - "integrity": "sha1-iXScY7BY19kNYZ+GuYqhU107l/A=", - "requires": { - "binary": "0.3.0", - "fstream": "0.1.31", - "match-stream": "0.0.2", - "pullstream": "0.4.1", - "readable-stream": "1.0.34", - "setimmediate": "1.0.5" - }, - "dependencies": { - "fstream": { - "version": "0.1.31", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-0.1.31.tgz", - "integrity": "sha1-czfwWPu7vvqMn1YaKMqwhJICyYg=", - "requires": { - "graceful-fs": "3.0.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.4.5" - } - }, - "graceful-fs": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", - "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", - "requires": { - "natives": "1.1.6" - } - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - } - } - }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -5532,18 +5138,11 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, "requires": { "isexe": "2.0.0" } }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "requires": { - "string-width": "2.1.1" - } - }, "winchan": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/winchan/-/winchan-0.2.1.tgz", diff --git a/package.json b/package.json index 4858b5e..9074b0f 100755 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ }, "dependencies": { "async-mutex": "^0.1.3", + "legacy-processor-module": "git+https://github.com/topcoder-platform/legacy-processor-module.git#develop", "axios": "^0.18.0", "bluebird": "^3.5.3", "config": "^1.30.0", @@ -23,13 +24,10 @@ "dotenv": "^6.0.0", "flatted": "^2.0.0", "http-json-response": "^1.0.1", - "ifxnjs": "^8.0.1", + "informix": "coderReview/node-informix.git#master", "joi": "^13.4.0", - "legacy-processor-module": "git+https://github.com/topcoder-platform/legacy-processor-module.git#master", "lodash": "^4.17.10", - "moment": "^2.24.0", "no-kafka": "^3.2.10", - "q": "^1.5.1", "tc-core-library-js": "appirio-tech/tc-core-library-js.git#v2.6", "topcoder-healthcheck-dropin": "^1.0.2", "winston": "^2.4.2" @@ -54,8 +52,5 @@ "exclude": [ "test/*.js" ] - }, - "engines": { - "node": "8.x" } } diff --git a/src/services/SubmissionService.js b/src/services/SubmissionService.js index 52d4fd2..80c2bb9 100755 --- a/src/services/SubmissionService.js +++ b/src/services/SubmissionService.js @@ -1,12 +1,12 @@ /** * The service to handle new submission events for non-MM challenge. */ -const config = require('config'); -const Joi = require('joi'); +const config = require("config"); +const Joi = require("joi"); -const logger = require('legacy-processor-module/common/logger'); -const Schema = require('legacy-processor-module/Schema'); -const LegacySubmissionIdService = require('legacy-processor-module/LegacySubmissionIdService'); +const logger = require("legacy-processor-module/common/logger"); +const Schema = require("legacy-processor-module/Schema"); +const LegacySubmissionIdService = require("legacy-processor-module/LegacySubmissionIdService"); // The event schema to validate events from Kafka const eventSchema = Schema.createEventSchema({ @@ -28,12 +28,15 @@ const eventSchema = Schema.createEventSchema({ */ async function handle(event) { if (!event) { - logger.debug('Skipped null or empty event'); + logger.debug("Skipped null or empty event"); return; } // Check topic and originator - if (event.topic !== config.KAFKA_AGGREGATE_SUBMISSION_TOPIC) { + if ( + event.topic !== config.KAFKA_NEW_SUBMISSION_TOPIC && + event.topic !== config.KAFKA_UPDATE_SUBMISSION_TOPIC + ) { logger.debug(`Skipped event from topic ${event.topic}`); return; } @@ -43,7 +46,7 @@ async function handle(event) { return; } - if (event.payload.resource !== 'submission') { + if (event.payload.resource !== "submission") { logger.debug(`Skipped event from resource ${event.payload.resource}`); return; } @@ -54,10 +57,16 @@ async function handle(event) { } // Attempt to retrieve the subTrack of the challenge - const subTrack = await LegacySubmissionIdService.getSubTrack(event.payload.challengeId); - logger.debug(`Challenge ${event.payload.challengeId} get subTrack ${subTrack}`); + const subTrack = await LegacySubmissionIdService.getSubTrack( + event.payload.challengeId + ); + logger.debug( + `Challenge ${event.payload.challengeId} get subTrack ${subTrack}` + ); - const mmChallangeSubtracks = config.MM_CHALLENGE_SUBTRACK.split(',').map(x => x.trim()); + const mmChallangeSubtracks = config.MM_CHALLENGE_SUBTRACK.split(",").map(x => + x.trim() + ); // Skip MM challenge submissions if (!subTrack || mmChallangeSubtracks.includes(subTrack)) { @@ -65,20 +74,17 @@ async function handle(event) { return; } - if (event.payload.originalTopic === config.KAFKA_NEW_SUBMISSION_TOPIC) { + if (event.topic === config.KAFKA_NEW_SUBMISSION_TOPIC) { // Handle new submission logger.debug(`Started adding submission for ${event.payload.id}`); try { - const timestamp = Date.parse(event.payload.created); const patchObject = await LegacySubmissionIdService.addSubmission( event.payload.id, event.payload.challengeId, event.payload.memberId, event.payload.submissionPhaseId, event.payload.url, - event.payload.type, - timestamp, - false + event.payload.type ); logger.debug( @@ -87,7 +93,7 @@ async function handle(event) { }, patch: ${JSON.stringify(patchObject)}` ); } catch (error) { - logger.error(`Failed to handle ${JSON.stringify(event)}: ${error.message}`); + logger.error(`Failed to handle ${JSON.stringify(event)}: ${error.message}`) logger.error(error); } } else if (event.payload.url) { @@ -97,11 +103,15 @@ async function handle(event) { let legacySubmissionId = event.payload.legacySubmissionId; if (!legacySubmissionId) { // In case legacySubmissionId not present, try to get it from submission API - const submission = await LegacySubmissionIdService.getSubmission(event.payload.id); + const submission = await LegacySubmissionIdService.getSubmission( + event.payload.id + ); legacySubmissionId = submission.legacySubmissionId || 0; } - logger.debug(`Started updating URL for submission for ${legacySubmissionId}`); + logger.debug( + `Started updating URL for submission for ${legacySubmissionId}` + ); try { await LegacySubmissionIdService.updateUpload( event.payload.challengeId, @@ -117,7 +127,7 @@ async function handle(event) { }` ); } catch (error) { - logger.error(`Failed to handle ${JSON.stringify(event)}: ${error.message}`); + logger.error(`Failed to handle ${JSON.stringify(event)}: ${error.message}`) logger.error(error); } }