question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with hot reload and the typeorm

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kiwikerncommented, Jul 4, 2019
1reaction
psucodervncommented, Oct 16, 2018

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use TypeORM with hot-reloading without running into ...
When using TypeORM with Next.js, server-side hot-reloading is used by default and is convenient, except for one thing: Every time a hot ...
Read more >
no metadata was found. - You.com | The AI Search Engine ...
For me, this was happening after the webpack hot-reload because when everything was reloaded, new entity models were generated. Although new entity models...
Read more >
Hot reload | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines ...
Read more >
anyone else have problems with React's --template typescript ...
Hot reloading is... garbage. New files cause import errors. Doesn't detect random gibberish that should cause errors, but still detects other ...
Read more >
Best practice for instantiating PrismaClient with Next.js
Problem. Lots of users have come across this warning while working with ... each time due to hot reloading that creates a connection...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found