Comments (3)
Looks like this #499 issue, but I also tried creating a dynamic root module:
import { Module } from '@nestjs/common';
import { AWS_MODULE_CONFIG_TOKEN, AWS_S3_CLIENT_TOKEN } from './constants';
import * as ClientS3 from '@aws-sdk/client-s3';
import { S3 } from '@aws-sdk/client-s3';
import { createConfigurableDynamicRootModule } from '@golevelup/nestjs-modules';
import { AwsModuleConfig } from './aws-vendor.interfaces';
import { AwsS3Service } from './aws-vendor-s3.service';
@Module({})
export class AwsVendorProviderModule extends createConfigurableDynamicRootModule<AwsVendorProviderModule, AwsModuleConfig>(
AWS_MODULE_CONFIG_TOKEN,
{
providers: [
{
provide: AWS_S3_CLIENT_TOKEN,
useFactory: ({ s3 }: AwsModuleConfig): S3 => {
return new S3(<ClientS3.S3ClientConfig>s3);
},
inject: [AWS_MODULE_CONFIG_TOKEN]
},
AwsS3Service
],
exports: [AWS_MODULE_CONFIG_TOKEN, AWS_S3_CLIENT_TOKEN, AwsS3Service]
}
) {
}
Added to the App.Module, but when I try to use the AwsS3Service
that contains the decorator, it fails even if I add AwsVendorProviderModule.externallyConfigured(AwsVendorProviderModule, 0),
to the module that contains the issue. It gotta be something very simple, but I cannot figured it out...
from nestjs.
I solved doing the following, that looks to me like a hack:
- created AwsProviderModule Global
- forwardRef for AwsS3Service on services using it
@Inject(forwardRef(() => AwsS3Service))
- and this was the weirdest, I had to use the same technique for the services using AwsS3Service on the controller's constructor even though they were imported as providers.
Currently works, but I feel this is a hack. If you have a better solution I am all ears. Thank you!
from nestjs.
Found the problem, the issue was to make use of path aliases within the structure of the application, changing them to relative paths everything works.
from nestjs.
Related Issues (20)
- Single Channel Configuration Across Multiple @RabbitSubscribe Decorators Not Working as Expected
- No delivery mode option on AmqpConnection.request method HOT 2
- RabbitMQ: RabbitSubscribe using a handler name without corresponding handler config asserts randomized queues HOT 3
- rabbitmq: consumerTags are not cleaned up on connection/channel disconnect
- rabbitmq: canceled consumers are resumed if connection/channel reconnects HOT 1
- rabbitmq: direct sending to queue without the need for exchanges HOT 1
- rabbitmq: binding a queue to exchange without a routingKey
- ts-jest: Cannot create mock of a class which has private dependencies in constructor HOT 1
- rabbitmq: handlers didn't works in app-non-pub HOT 1
- golevelup/nestjs-stripe: project can not compile
- Stripe Test Webhook HOT 2
- Stripe webhooks - "undefined" is not valid JSON HOT 2
- How should I use this within RabbitSubscribe method?
- ts-vitest: using with `vi.spyOn` isn't working
- golevelup/nestjs-graphql-request: update dependencies [email protected]
- NestJs-rabbitmq Connection loss without reason && No reconnect HOT 1
- Vhost connection HOT 1
- decorators param for Stripe webhook not works HOT 1
- Problem to connect RabbitMQ in Docker HOT 3
- Stripe v15 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nestjs.