Nest: Problem with hot reload and the typeorm

Created on 20 May 2018  路  5Comments  路  Source: nestjs/nest

I'm submitting a...


[ ] Regression 
[*] 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

Im using the hotreload configuration as you mentioned. But the problem is I'm using the database typeorm when I hit reload the I'm getting error AlreadyHasActiveConnectionError: Cannot create a new connection named "default", because connection with such name already exist and it now has an active connection session.

I tried with the

module.hot.dispose(async () => {
    await getConnection().close();
    await app.close();
});

Expected behavior

It should reload normally

Minimal reproduction of the problem with instructions

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

Environment


Nest version: 5.0.0

For Tooling issues:

  • Node version: v10.1.0
  • Platform: Linux

Most helpful comment

@navigatetravel this is what I ended up doing: https://stackoverflow.com/a/54842659/4694994

All 5 comments

Hello, I'm facing a similar problem. How did you fix that?

I've created a question on SO for this: https://stackoverflow.com/q/54842295/4694994

+1. any solution for that?

@navigatetravel this is what I ended up doing: https://stackoverflow.com/a/54842659/4694994

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.

Was this page helpful?
0 / 5 - 0 ratings