benawad/type-graphql-series

"message": "No repository for \"GuestUserEntity\" was found. Looks like this entity is not registered in current \"default\" connection?",

Opened this issue · 5 comments

hello ben awad great series, but in my playground im encountering this problem. Please help me out
"message": "No repository for "GuestUserEntity" was found. Looks like this entity is not registered in current "default" connection?",

I'm having exactly the same problem, anyone knows the solution for this?

@henriquesaias post your typeorm config and entity location I will help you solving it

Awesome, thank you

{
  "type": "postgres",
  "host": "localhost",
  "port": 5432,
  "username": "postgres",
  "password": "postgres",
  "database": "SeedsOfLight",
  "entities": ["./src/entities/*.ts"],
  "migrations": ["./src/migrations/*.ts"],
  "cli": {
    "migrationsDir": "./src/migrations/"
  }
}

my entity is in src/entities/PlaylistSong.ts in the same folder as all the other entities that are working fine

There is problem in locating entities. Typeorm cant read them. Why don't you use something like "entities": ["src/entities/*.*"], in configuration and make sure typeorm.json/js is on root

I just spotted the bug.
Stupid mistake on my part.

In my createSongsLoader I had

import { PlaylistSong } from "../entities/playlistSong";
instead of
import { PlaylistSong } from "../entities/PlaylistSong";

Problem solved. Thank you for your time :)