No repository for "s" was found. Looks like this entity is not registered in current "default" connection?
See original GitHub issueI’m submitting a…
[ ] Regression
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
I’m using webpack and nestjs + postgres. In development mode, It’s worked OK but in production, I got error as below.
No repository for "s" was found. Looks like this entity is not registered in current "default" connection?
This is my config.
return {
type: "postgres",
host: this.getValue("POSTGRES_HOST"),
port: parseInt(this.getValue("POSTGRES_PORT")),
username: this.getValue("POSTGRES_USER"),
password: this.getValue("POSTGRES_PASSWORD"),
database: this.getValue("POSTGRES_DATABASE"),
entities: ["**/*.entity{.ts,.js}"],
migrationsTableName: "migration",
migrations: ["./dist/src/migration/*.ts"],
cli: {
migrationsDir: "./dist/src/migration"
}
};
I searched around and change entities: ["**/*.entity{.ts,.js}"], to entities: ["dist/**/*.entity{.ts,.js}"],
or entities: ["./dist/**/*.entity{.ts,.js}"],… but not luck.
Expected behavior
Worked on both of env.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
Nest version
```
"@nestjs/common": "^6.8.0",
"@nestjs/core": "^6.8.0",
"@nestjs/passport": "^6.1.1",
"@nestjs/platform-express": "^6.8.0",
"@nestjs/swagger": "^3.1.0",
"@nestjs/typeorm": "^6.2.0",
```
For Tooling issues:
- Node version: 12.3.1
- Platform: Mac
Others:
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Error: RepositoryNotFoundError: No repository for [Enitity] ...
RepositoryNotFoundError is throw in case your entity isnt properly registered in connections. This could be caused wrong path (glob pattern) in ...
Read more >No repository for "User" was found. Looks like this entity is ...
RepositoryNotFoundError : No repository for "User" was found. Looks like this entity is not registered in current "default" connection? Typeorm.
Read more >typeorm/typeorm - Gitter
"RepositoryNotFoundError: No repository for "MyModelName" was found. Looks like this entity is not registered in current "default" connection?".
Read more >How to Configure TypeORM to Work in Transpiled ...
RepositoryNotFoundError : No repository for "User" was found. Looks like this entity is not registered in current "default" connection?
Read more >no metadata for repository was found
EntityMetadataNotFound error is displayed when TypeORM cant find your entities. Often this is caused by wrong/misspelled entry in your ormconfig file. If you ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try giving a name to your entity with the
@Entitydecorator:I was having the same problem and this solved it. Thank you! @etienne-martin