Git Product home page Git Product logo

Comments (3)

hfhchan-plb avatar hfhchan-plb commented on June 2, 2024 4

OK this is not working because I did this:

    TypeOrmModule.forRootAsync({
      inject: [ConfigService],
      name: 'pg',
      useFactory: (configService: ConfigService) => ({
        type: 'postgres',
        /* SNIP */
      }),
    })

instead of:

    TypeOrmModule.forRootAsync({
      inject: [ConfigService],
      name: 'pg',
      useFactory: (configService: ConfigService) => ({
        name: 'pg',
        type: 'postgres',
        /* SNIP */
      }),
    })

i.e. I was missing the name parameter inside the object returned by useFactory, hence it couldn't match it up.

from typeorm.

hfhchan-plb avatar hfhchan-plb commented on June 2, 2024

The issue looks like it could be fixed by moving

const dataSource = this.moduleRef.get<DataSource>(
getDataSourceToken(this.options as DataSourceOptions) as Type<DataSource>,
);
into the try/catch loop below, but I'm not sure why this.moduleRef.get(getDataSourceToken(this.options)); would be returning undefined.

from typeorm.

hfhchan-plb avatar hfhchan-plb commented on June 2, 2024

This is actually also related to #1512, where the name parameter in TypeOrmModuleOptions is marked deprecated because it inherits fromtypeorm, but is actually required by @nestjs/typeorm to function correctly.

from typeorm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.