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

TypeError: Cannot redefine property: manager #26

Open
Leonelmarianog opened this issue Jan 8, 2023 · 3 comments
Open

TypeError: Cannot redefine property: manager #26

Leonelmarianog opened this issue Jan 8, 2023 · 3 comments

Comments

@Leonelmarianog
Copy link

Leonelmarianog commented Jan 8, 2023

Hello,

Using this library with the following NestJS configuration (Webpack's Hot Module Replacement) makes the following error appear when reloading the app.

image

This doesn't break the app but is quite annoying in development.

I tried to fix it by following this question.

image

But it makes it worse.

error-typeorm-transactional-2

What can I do?.

Thanks!.

@Leonelmarianog
Copy link
Author

Created a minimal reproduction repository for this: https://github.com/Leonelmarianog/typeorm-transactional-test

@no-creative-name
Copy link

no-creative-name commented Feb 27, 2023

I have the same error, though it only occurs when using the latest version (0.4.1). If I downgrade to 0.3.0 everything works flawlessly.

@no-creative-name
Copy link

no-creative-name commented Jun 5, 2023

For me it works when I wrap the call to initializeTransactionalContext into a conditional if statement, that checks if there is already a context initialized:

const transactionalContext = getTransactionalContext();
  if (!transactionalContext) {
    initializeTransactionalContext();
  }

getTransactionalContext is imported from typeorm-transactional/dist/common

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

2 participants