nest-oidc-provider icon indicating copy to clipboard operation
nest-oidc-provider copied to clipboard

How to fix middleware parser is not recommended warning message

Open remithomas opened this issue 3 years ago • 3 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

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

  • [X] oidc-provider
  • [X] nest-oidc-provider
  • [ ] I don't know. Or some 3rd-party package
  • [ ] Other (see below)

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?

  • [X] macOS
  • [ ] Windows
  • [ ] Linux

Other

No response

remithomas avatar Sep 24 '22 23:09 remithomas

i had the same thing, but i got error 500

jdnielss avatar Oct 31 '22 10:10 jdnielss

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

adrianbrs avatar Dec 04 '22 09:12 adrianbrs

The versions are:

  • oidc-provider: 7.14.0
  • nest-oidc-provider: 1.1.1

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

remithomas avatar Mar 08 '23 20:03 remithomas