Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golevelup/nestjs-stripe: project can not compile #730

Open
TropicalPunch opened this issue Apr 20, 2024 · 0 comments
Open

golevelup/nestjs-stripe: project can not compile #730

TropicalPunch opened this issue Apr 20, 2024 · 0 comments

Comments

@TropicalPunch
Copy link

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
            }
        }
    }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant