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

Dynamic Module that implements NestModule does not invoke configure #3219

Closed
jasperblues opened this issue Oct 20, 2019 · 3 comments
Closed
Labels
needs triage This issue has not been looked into

Comments

@jasperblues
Copy link

jasperblues commented Oct 20, 2019

Bug Report

From what I can see a DynamicModule (eg assembled from a module builder class) does not invoke configure from NestModule interface, even if the built module conforms to this protocol.

Current behavior

    public build(): DrivineModule {
        return Object.assign(new DrivineModule(), {
            module: DrivineModule,
            providers: this.providers,
            exports: this.providers,
            configure(consumer: MiddlewareConsumer): any {
                this.logger.log(`Applying transactional context middleware`);
                consumer.apply(TransactionContextMiddleware).forRoutes('**/**');
            }
        });
    }

^-- the configure method above is not invoked.

Sorry if this report contains insufficient details - super busy atm. Please close it, if it is not helpful and I will report back with more information when I'm not busy.

@jasperblues jasperblues added the needs triage This issue has not been looked into label Oct 20, 2019
@kamilmysliwiec
Copy link
Member

public build(): DrivineModule {
        return Object.assign(new DrivineModule(), {
            module: DrivineModule,
            providers: this.providers,
            exports: this.providers,
            configure(consumer: MiddlewareConsumer): any {
                this.logger.log(`Applying transactional context middleware`);
                consumer.apply(TransactionContextMiddleware).forRoutes('**/**');
            }
        });
    }

The above code is wrong and can't work properly.
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.

@jasperblues
Copy link
Author

Thank you - will be reasonably certain (99%) that there's a genuine bug in future.

Meanwhile, there's a good community on the Discord channel and I received the advice that I needed.

@lock
Copy link

lock bot commented Jan 24, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

2 participants