akveo / ngx-admin-bundle-support

Support repository for ngx-admin backend bundles with issues tracking, instructions and code samples
58 stars 32 forks source link

NestJS Nest can't resolve dependencies of the UserService (?, SettingsService). #45

Open Josexv1 opened 4 years ago

Josexv1 commented 4 years ago

When you start the APP this is the error you get, also testing with e2e will give the error too.

$ jest --config ./test/jest-e2e.json
 FAIL  test/app.e2e-spec.ts (10.787s)
  AppController (e2e)
    × / (GET) (252ms)

  ● AppController (e2e) › / (GET)

    Nest can't resolve dependencies of the UserService (?, SettingsService). Please make sure that the argument UserModel at index [0] is available in the AuthModule context.

    Potential solutions:
    - If UserModel is a provider, is it part of the current AuthModule?
    - If UserModel is exported from a separate @Module, is that module imported within AuthModule?
      @Module({
        imports: [ /* the Module containing UserModel */ ]
      })

      at Injector.lookupComponentInExports (../node_modules/@nestjs/core/injector/injector.js:185:19)
      at Injector.resolveComponentInstance (../node_modules/@nestjs/core/injector/injector.js:142:33)
      at resolveParam (../node_modules/@nestjs/core/injector/injector.js:96:38)
          at async Promise.all (index 0)
      at Injector.resolveConstructorParams (../node_modules/@nestjs/core/injector/injector.js:111:27)
      at Injector.loadInstance (../node_modules/@nestjs/core/injector/injector.js:78:9)
      at Injector.loadProvider (../node_modules/@nestjs/core/injector/injector.js:35:9)
          at async Promise.all (index 6)
      at InstanceLoader.createInstancesOfProviders (../node_modules/@nestjs/core/injector/instance-loader.js:41:9)
      at ../node_modules/@nestjs/core/injector/instance-loader.js:27:13
          at async Promise.all (index 3)
      at InstanceLoader.createInstances (../node_modules/@nestjs/core/injector/instance-loader.js:26:9)
      at InstanceLoader.createInstancesOfDependencies (../node_modules/@nestjs/core/injector/instance-loader.js:16:9)
      at TestingModuleBuilder.compile (../node_modules/@nestjs/testing/testing-module.builder.js:38:9)

● AppController (e2e) › / (GET)                                                                                                                                                                                                                                                                                                                                                               TypeError: Cannot read property 'getHttpServer' of undefined                                                                                                                                                                                                                                                                                                                                  22 |                                                                                                                                                                                          23 |   it('/ (GET)', () => {                                                                                                                                                                > 24 |     return request(app.getHttpServer())                                                                                                                                                     |                        ^                                                                                                                                                                 25 |       .get('/')                                                                                                                                                                          26 |       .expect(200)                                                                                                                                                                       27 |       .expect('Hello World!');                                                                                                                                                                                                                                                                                                                                                         at Object.<anonymous> (app.e2e-spec.ts:24:24)
Josexv1 commented 4 years ago

I commented UserService and SettingsService, in auth.module, and now it works, but now there's a bunch of deprecations in MongoDB

(node:10536) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect. (node:10536) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

This is another deprecation. {"level":"debug","message":"[NestApplication]: Nest application successfully started"} {"message":"[JwtService]: \"secretOrPrivateKey\" has been deprecated, please use the new explicit \"secret\" or use \"secretOrKeyProvider\" or \"privateKey\"/\"publicKey\" exclusively.","level":"warn"}

Edit:

Swagger authentication is not working either, somehow it logins but the authorization token doesn't work inside the Swagger UI. It works inside the normal app tho.

Reset passwork is not working either {"message":"[ExceptionsHandler]: Reset password token is missing or invalid","level":"error"}

Settings like Name, Age, etc stays in local storage instead of storing them in the Database.

Edit 2:

Some of the functions in the user management gives error 500, Internal server error, instead of showing what the error is, for example when registering the same email.