A Transactional Method Decorator for TypeORM that uses Async Local Storage or cls-hooked to handle and propagate transactions between different repositories and service methods.
MIT License
201
stars
27
forks
source link
SyntaxError: Cannot use import statement outside a module #25
If I run NestJS application on AWS Elastic Beanstalk, TypeError is occurred after deploy.
There is no issue in my local environment. It only occurs in ELB.
However environment variables are completely same, and Node 14.x and 16.x both have same problem.
* ormconfig.ts
```typescript
const ormconfig: TypeOrmModuleOptions = {
type: 'mysql',
host: process.env.DATABASE_MASTER_HOST,
...
synchronize: true,
migrationsRun: true,
logging: true,
keepConnectionAlive: true,
namingStrategy: new SnakeNamingStrategy(),
entities: [__dirname + '/**/*.entity.{js,ts}'],
subscribers: ['src/subscriber/**/*.ts'],
migrations: [__dirname + '/database/migrations/**/*.ts'],
migrationsTableName: 'migrations',
}
export default ormconfig;
@Module({ imports: [ ConfigModule.forRoot({ isGlobal: true, cache: true, }), TypeOrmModule.forRootAsync({ useFactory: () => ormconfig, dataSourceFactory: async (options) => { const dataSource = await addTransactionalDataSource({ dataSource: new DataSource(options), patch: true, }) return dataSource; }, }), ... ], controllers: [...], providers: [...], }) export class AppModule implements NestModule { ... }