Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in back... i cant access because de keys.pub #7

Open
marcelogalvones opened this issue Oct 4, 2022 · 3 comments
Open

Error in back... i cant access because de keys.pub #7

marcelogalvones opened this issue Oct 4, 2022 · 3 comments

Comments

@marcelogalvones
Copy link

image

@thomasfischer-his
Copy link

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)

@thomasfischer-his
Copy link

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)

@NashiCodes
Copy link

i'm facing the same issue, how can i fix ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants