Search code examples
node.jsauthenticationnestjspassport.jsmern

Getting error "Login Error TypeError: Cannot read property 'register' of undefined"


I am trying to register a user using nestjs . when I tried to register my user I have an error like this. I spend hours to find out what went wrong, but I ca;t found a thing.I really need your help with this one.

enter image description here

enter image description here

This is my error : enter image description here


Solution

  • As discussed on our Discord, you forgot to add the @Injectable() decorator to your AuthenticaitonService class, which made the DI service not understand that something was supposed to be injected and thus caused the error