@Module({
imports: [PassportModule.register({ session: false })],
providers: [ClerkStrategy, ApiKeyStrategy],
})
export class AuthModule implements NestModule {
constructor(private readonly configService: ConfigService) {}
configure(consumer: MiddlewareConsumer) {
consumer
.apply(new SvixWebhookVerifyMiddleware(this.configService.getOrThrow('AUTH_MODULE_WEBHOOK_SECRET')))
.forRoutes({ method: RequestMethod.POST, path: '/auth/webhook', version: 'v1' });
}
}
The above code fails with following error
src/auth/auth.module.ts:17:14 - error TS2345: Argument of type 'SvixWebhookVerifyMiddleware' is not assignable to parameter of type 'Function | Type<any>'.
17 .apply(new SvixWebhookVerifyMiddleware(this.configService.getOrThrow('AUTH_MODULE_WEBHOOK_SECRET')))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~