nestjs
nestjs copied to clipboard
golevelup/nestjs-stripe: project can not compile
Hi, i've been triyng to use this tutorial to connect my project to stripe. for some reason i keep gettig this error when running the server in local host: **" Nest can't resolve dependencies of the DiscoveryService (?, MetadataScanner). Please make sure that the argument ModulesContainer at index [0] is available in the DiscoveryModule context. Potential solutions:
-
Is DiscoveryModule a valid NestJS module?
-
If ModulesContainer is a provider, is it part of the current DiscoveryModule?
-
If ModulesContainer is exported from a separate @Module, is that module imported within DiscoveryModule? @Module({ imports: [ /* the Module containing ModulesContainer / ] }) "* not sure if it's a coniguration issue on my side or something else, would love to get some help :) system: "@nestjs/common": "^9.0.0", "@nestjs/config": "^3.1.1", "@nestjs/core": "^9.0.0", "stripe": "^14.25.0", "@golevelup/nestjs-stripe": "^0.7.0",
payment module
import { DynamicModule, Module, Provider } from '@nestjs/common';
import { ConfigModule,ConfigService } from '@nestjs/config';
import {
StripeModule
} from '@golevelup/nestjs-stripe';
import { PaymentService } from './payment.service';
import { PaymentController } from './payment.controller';
import { Stripe } from 'stripe';
@Module({
imports:[StripeModule.forRootAsync(StripeModule, {
imports: [ConfigModule],
useFactory: (configService: ConfigService) =>
configService.get('stripe'),
inject: [ConfigService],
}),],
controllers: [PaymentController],
providers: [PaymentService]
})
export class PaymentModule {}
**app module**
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
load: [config]
}),
...
....
PaymentModule
],
controllers: [AppController],
providers: [
AppService...
],
})
config structure:
export const config = () => ({
...
stripe: {
apiKey: process.env.STRIPE_API_KEY,
webhookConfig: {
requestBodyProperty: 'rawBody',
stripeSecrets: {
account: process.env.STRIPE_WEBHOOK_SECRET
}
}
}
});
Yeah! I'm also using nestjs v9. and got the same issue. @TropicalPunch have you resolved it?
Please upgrade to nestjs v10 because the mismatch here is the issue, the dependency injection breaks