Connection "default" was not found with TypeORM

You are trying to create a repository or manager without the connection being established.

Try doing this const shopkeeperRepository = getRepository(Shopkeeper); inside a function. it will work


the upvoted answer is not necessarily correct, if you not specify the connection name it will default to "default".

const manager = getConnectionManager().get('your_orm_name');
const repository = manager.getRepository<AModel>(Model);

If anyone else has this problem in the future, check this out just in case:

I accidentally did "user.save()" instead of "userRepo.save(user)".

(And of course above initializing the connection like this:

const userRepo = getConnection(process.env.NODE_ENV).getRepository(User)