No design-time type metadata found error with Loopback
Asked Answered
M

2

5

I have the following 500 error when executing a controller with Loopback 4.

Unhandled error in GET /v1/me/societes: 500 Error: No design-time type metadata found while inspecting FirebaseAuthService.constructor[2]. You can either use `@service(ServiceClass)` or ensure `emitDecoratorMetadata` is enabled in your TypeScript configuration. Run `tsc --showConfig` to print the final TypeScript configuration of your project.

I think the problem is because of FirebaseService injection here :

@injectable({scope: BindingScope.SINGLETON})
export class FirebaseAuthService {
  constructor(
    @repository(UtilisateurRepository)
    public utilisateurRepository: UtilisateurRepository,
    @repository(TokenRepository)
    public tokenRepository: TokenRepository,
    @service(FirebaseService)
    public firebaseService: FirebaseService,
  ) {}

But the FirebaseService class looks OK :

@injectable({scope: BindingScope.SINGLETON})
export class FirebaseService {

All my service classes are in src/services directory, so they should be registered by Loopback. Or maybe my problem has nothing to deal with service injections ?

I try to understand this for hours. Anyone has an idea ?

Thanks for your help !

Olivier

Morrissette answered 20/11, 2020 at 11:4 Comment(0)
V
13

I have the same problem. You need to import the full path to this file instead of folder. EX: import ServiceA from './services/service-a.service';

Vikki answered 7/1, 2021 at 3:19 Comment(1)
Anybody know how this solves the issue? I'm guessing that resolving the class metadata uses the imported path as a key somewhere...Obsolescent
U
1

I solved this issue by removing circular dependency in service injections

Ultranationalism answered 15/2, 2021 at 13:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.