adrianbrs / nest-oidc-provider

oidc-provider module for Nest framework (node.js)
MIT License
54 stars 16 forks source link

How to fix middleware parser is not recommended warning message #15

Open remithomas opened 2 years ago

remithomas commented 2 years ago

Is there an existing issue for this?

Current behavior

I'm getting this warning

oidc-provider WARNING: already parsed request body detected, having upstream middleware parser is not recommended, resolving to use req.body or request.body instead

when doing a client_credentials token request (/oidc/token)

Minimum reproduction code

No response

Steps to reproduce

No response

Expected behavior

How can I avoid this warning ? It should be handled by the module or a configuration path ?

Package

Other package

No response

NestJS version

9.0.11

Packages versions

platform-express version : 9.0.11
schematics version       : 9.0.1
passport version         : 9.0.0
terminus version         : 9.1.1
graphql version          : 10.1.1
swagger version          : 6.1.2
typeorm version          : 9.0.1
testing version          : 9.0.5
apollo version           : 10.1.0
common version           : 9.0.11
config version           : 2.2.0
axios version            : 0.1.0
core version             : 9.0.11
jwt version              : 9.0.0
cli version              : 9.0.0

Node.js version

16.15.1

In which operating systems have you tested?

Other

No response

jdnielss commented 2 years ago

i had the same thing, but i got error 500

adrianbrs commented 1 year ago

Hi @remithomas. Sorry for the late reply! What version of oidc-provider and nest-oidc-provider are you using? This warning message means that you parsed the body before the request reached the provider controller, but I tried and failed to reproduce this warning message with this repo's example project. If you can provide me with a simple reproduction code that shows this warning message I can have a better look

remithomas commented 1 year ago

The versions are:

It is setup like this:

// app.module.ts
@Module({
  imports: [
    OidcModule.forRootAsync({
      imports: [ConfigModule],
      useFactory: async (dbService: DataSource, configService: ConfigService) => {
        const oidc = await getOidcProviderConfiguration(dbService, configService);

        return {
          issuer: configService.get<string>('ISSUER'),
          path: '/oidc',
          proxy: true,
          oidc,
        };
      },
      inject: [DataSource, ConfigService],
    }),
],
  controllers: [],
  providers: [],
})
export class AppModule {}

I will create a repo to help you