Open marcelogalvones opened 2 years ago
Here is the same issue in text form. Line numbers have slightly changed:
[1:57:12 PM] Starting compilation in watch mode...
DeprecationWarning: 'getMutableClone' has been deprecated since v4.0.0. Use an appropriate `factory.update...` method instead, use `setCommentRange` or `setSourceMapRange`, and avoid setting `parent`.
DeprecationWarning: 'createLiteral' has been deprecated since v4.0.0. Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead.
[1:57:26 PM] Found 0 errors. Watching for file changes.
Error: ENOENT: no such file or directory, open '../keys.pub'
at Object.openSync (node:fs:594:3)
at readFileSync (node:fs:462:35)
at Object.<anonymous> (/usr/app/monitor-server/src/auth/constants.ts:5:26)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/usr/app/monitor-server/src/auth/jwt.strategy.ts:4:1)
I tried to work around this problem by surrounding the calls on readFileSync
with a ternary operator that checks if the file exists (using existsSync
) and in the 'else' part returns null
. This works if applied to the case of ../keys.pub
and ../keys
in src/auth/constants.ts
. Example:
privateKey: existsSync('../keys') ? readFileSync('../keys') : null
Once that is fixed, a similar problem occurs in src/amp/amp.controlers.ts
for file ../black-list.txt
. This can be fixed in a similar manner. Again, a ternary operator when variable isValid
is initialized, setting it to true
if no blacklist file was loaded.
Then, same problem in src/app.modules.ts
where a 'database config' file ../monitor_db.json
is loaded. Although the missing file can be worked around again by using the ternary operators here was well, running the code now stops due to missing information about which database to use:
[2:35:29 PM] Starting compilation in watch mode...
DeprecationWarning: 'getMutableClone' has been deprecated since v4.0.0. Use an appropriate `factory.update...` method instead, use `setCommentRange` or `setSourceMapRange`, and avoid setting `parent`.
DeprecationWarning: 'createLiteral' has been deprecated since v4.0.0. Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead.
[2:35:44 PM] Found 0 errors. Watching for file changes.
[Nest] 144 - 11/14/2022, 2:35:46 PM LOG [NestFactory] Starting Nest application...
[Nest] 144 - 11/14/2022, 2:35:46 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +164ms
[Nest] 144 - 11/14/2022, 2:35:46 PM LOG [InstanceLoader] RateLimiterModule dependencies initialized +1ms
[Nest] 144 - 11/14/2022, 2:35:46 PM LOG [InstanceLoader] JwtModule dependencies initialized +1ms
[Nest] 144 - 11/14/2022, 2:35:46 PM LOG [InstanceLoader] DiscoveryModule dependencies initialized +1ms
[Nest] 144 - 11/14/2022, 2:35:46 PM LOG [InstanceLoader] ServeStaticModule dependencies initialized +1ms
[Nest] 144 - 11/14/2022, 2:35:46 PM LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
[Nest] 144 - 11/14/2022, 2:35:46 PM LOG [InstanceLoader] AppModule dependencies initialized +1ms
[Nest] 144 - 11/14/2022, 2:35:46 PM LOG [InstanceLoader] StampModule dependencies initialized +1ms
[Nest] 144 - 11/14/2022, 2:35:46 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED 127.0.0.1:3306
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)
--------------------
at Protocol._enqueue (/usr/app/monitor-server/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/usr/app/monitor-server/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at PoolConnection.connect (/usr/app/monitor-server/node_modules/mysql/lib/Connection.js:116:18)
at Pool.getConnection (/usr/app/monitor-server/node_modules/mysql/lib/Pool.js:48:16)
at /usr/app/monitor-server/src/driver/mysql/MysqlDriver.ts:1025:18
at new Promise (<anonymous>)
at MysqlDriver.createPool (/usr/app/monitor-server/src/driver/mysql/MysqlDriver.ts:1022:16)
at MysqlDriver.<anonymous> (/usr/app/monitor-server/src/driver/mysql/MysqlDriver.ts:369:36)
at step (/usr/app/monitor-server/node_modules/tslib/tslib.js:144:27)
at Object.next (/usr/app/monitor-server/node_modules/tslib/tslib.js:125:57)
[Nest] 144 - 11/14/2022, 2:35:49 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED 127.0.0.1:3306
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)
--------------------
at Protocol._enqueue (/usr/app/monitor-server/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/usr/app/monitor-server/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at PoolConnection.connect (/usr/app/monitor-server/node_modules/mysql/lib/Connection.js:116:18)
at Pool.getConnection (/usr/app/monitor-server/node_modules/mysql/lib/Pool.js:48:16)
at /usr/app/monitor-server/src/driver/mysql/MysqlDriver.ts:1025:18
at new Promise (<anonymous>)
at MysqlDriver.createPool (/usr/app/monitor-server/src/driver/mysql/MysqlDriver.ts:1022:16)
at MysqlDriver.<anonymous> (/usr/app/monitor-server/src/driver/mysql/MysqlDriver.ts:369:36)
at step (/usr/app/monitor-server/node_modules/tslib/tslib.js:144:27)
at Object.next (/usr/app/monitor-server/node_modules/tslib/tslib.js:125:57)
[Nest] 144 - 11/14/2022, 2:35:52 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)...
Error: connect ECONNREFUSED 127.0.0.1:3306
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)
--------------------
at Protocol._enqueue (/usr/app/monitor-server/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/usr/app/monitor-server/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at PoolConnection.connect (/usr/app/monitor-server/node_modules/mysql/lib/Connection.js:116:18)
at Pool.getConnection (/usr/app/monitor-server/node_modules/mysql/lib/Pool.js:48:16)
at /usr/app/monitor-server/src/driver/mysql/MysqlDriver.ts:1025:18
at new Promise (<anonymous>)
at MysqlDriver.createPool (/usr/app/monitor-server/src/driver/mysql/MysqlDriver.ts:1022:16)
at MysqlDriver.<anonymous> (/usr/app/monitor-server/src/driver/mysql/MysqlDriver.ts:369:36)
at step (/usr/app/monitor-server/node_modules/tslib/tslib.js:144:27)
at Object.next (/usr/app/monitor-server/node_modules/tslib/tslib.js:125:57)
i'm facing the same issue, how can i fix ?