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.

question: passing Container to TypeORM useContainer fails

See original GitHub issue

Description

registering Container with typeorm’s useContainer does not work anymore as of the latest release 0.9.0 It throws the following error which is fine for services

image

Minimal code-snippet showcasing the problem

import { Container } from 'typedi';
import {  useContainer } from 'typeorm';

....
useContainer(Container);

Unless I am missing something, this should not fail.

Expected behavior

It used to work fine. This has stopped working as of 0.9.0.

Actual behavior

It should not fail on passing typedi Container to typeorm

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:15
  • Comments:27 (8 by maintainers)

github_iconTop GitHub Comments

9reactions
4maticcommented, Oct 18, 2021

In typeorm-typedi-extensions@0.4.1 has been added custom Container to register with TypeORM. So changing from:

import { Container } from "typedi";
import { useContainer } from "typeorm";
useContainer(Container);

to

import { Container } from "typeorm-typedi-extensions";
import { useContainer } from "typeorm";
useContainer(Container);

helps.

5reactions
ianldgscommented, Feb 15, 2021

For now I have downgraded to typedi@0.8.0 and it’s working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typeorm/typeorm - Gitter
I tried to do a connection for each user as well, but have same problem. Following the log output and code I use...
Read more >
ConnectionManager error using typeorm implementing typedi
However, I'd already placed useContainer(Container) above the connection settings. src/index.ts (Entry File) import './utils/env' import ' ...
Read more >
typedi - Bountysource
question : passing Container to TypeORM useContainer fails $ 0. Created 1 year ago in typestack/typedi with 20 comments. Description. registering Container with ......
Read more >
typeorm: CHANGELOG
entities , migrations , subscribers options inside DataSourceOptions accepting string directories support is deprecated. You'll be only able to pass entity ...
Read more >
typeorm cannot read properties of undefined - You.com
But i added { eager: true } and then solved my problem. Open side panel ... useContainer(app.select(AppModule), { fallbackOnErrors: true });.
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