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

Cannot read property 'close' of undefined #1156

Closed
hajekj14 opened this issue Oct 3, 2018 · 3 comments
Closed

Cannot read property 'close' of undefined #1156

hajekj14 opened this issue Oct 3, 2018 · 3 comments

Comments

@hajekj14
Copy link

hajekj14 commented Oct 3, 2018

Cannot read property 'close' of undefined


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Sometimes when application is stoped by SIGTERM or SIGINT unhandled rejection occurs in io-adapter.ts server is undefined:

public close(server: any) {
isFunction(server.close) && server.close();
}

Err:
TypeError: Cannot read property 'close' of undefined
at Server.close (/home/ladin/rapid/git/ra-web-core-be/node_modules/socket.io/lib/index.js:485:15)
at IoAdapter.close (/home/ladin/rapid/git/ra-web-core-be/node_modules/@nestjs/websockets/adapters/io-adapter.js:53:59)
at MapIterator.Promise.all.iterare_1.default.map [as iteratee] (/home/ladin/rapid/git/ra-web-core-be/node_modules/@nestjs/websockets/socket-module.js:48:114)
at MapIterator.next (/home/ladin/rapid/git/ra-web-core-be/node_modules/iterare/src/map.ts:11:39)
at IteratorWithOperators.next (/home/ladin/rapid/git/ra-web-core-be/node_modules/iterare/src/iterate.ts:21:28)
at Function.all ()
at SocketModule.close (/home/ladin/rapid/git/ra-web-core-be/node_modules/@nestjs/websockets/socket-module.js:48:23)
at NestMicroservice.closeApplication (/home/ladin/rapid/git/ra-web-core-be/node_modules/@nestjs/microservices/nest-microservice.js:97:55)
at NestMicroservice.close (/home/ladin/rapid/git/ra-web-core-be/node_modules/@nestjs/microservices/nest-microservice.js:85:43)
at
at process._tickDomainCallback (internal/process/next_tick.js:228:7) }

Expected behavior

Test if server instance is initialized

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


Nest version: @nestjs/websockets 5.1.0

 
For Tooling issues:
- Node version: v8.11.3  
- Platform:  Win 10

Others:

@kamilmysliwiec
Copy link
Member

Fixed in 5.3.12

@hajekj14
Copy link
Author

Fixed in 5.3.12

But in websockets/adapters/io-adapter.ts is still same problem, fixed only on ws-adapter.ts, is that right?

@lock
Copy link

lock bot commented Sep 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants