情况:
ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'logIn')
TypeError: Cannot read properties of undefined (reading 'logIn')
at authenticate (/home/gleb/Projects/artwine-api/node_modules/passport/lib/middleware/authenticate.js:96:21)
at /home/gleb/Projects/artwine-api/node_modules/@nestjs/passport/dist/auth.guard.js:91:3
at new Promise (<anonymous>)
at /home/gleb/Projects/artwine-api/node_modules/@nestjs/passport/dist/auth.guard.js:83:83
at JWTAccessAuthGuard.<anonymous> (/home/gleb/Projects/artwine-api/node_modules/@nestjs/passport/dist/auth.guard.js:49:36)
at Generator.next (<anonymous>)
at fulfilled (/home/gleb/Projects/artwine-api/node_modules/@nestjs/passport/dist/auth.guard.js:17:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Run Code Online (Sandbox Code Playgroud)
捕获错误的护照库函数的代码:
return function authenticate(req, res, next) {
req.login =
req.logIn = req.logIn || IncomingMessageExt.logIn;
req.logout =
req.logOut = req.logOut || IncomingMessageExt.logOut;
req.isAuthenticated …Run Code Online (Sandbox Code Playgroud) 我一直在开发一个连接到本地 Postgres 数据库的 NestJS-GraphQL 应用程序。一切都工作正常,直到 Ubuntu 20.04 重新安装。
在使用项目克隆存储库、安装 Postgres 并使用yarn start:dev构建应用程序后,我可以看到这个奇怪的错误:
[Nest] 21577 - 02/05/2022, 2:51:10 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: getaddrinfo EAI_AGAIN postgres
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)
Run Code Online (Sandbox Code Playgroud)
Postgres 正在运行:
hleb@hleb:~$ psql artwine postgres
psql (14.1 (Ubuntu 14.1-2.pgdg20.04+1))
Type "help" for help.
artwine=#
Run Code Online (Sandbox Code Playgroud)
/etc/postgresql/14/main/pg_hba.conf
# Database administrative login by Unix domain socket
local all postgres trust
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket …Run Code Online (Sandbox Code Playgroud)