You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moreover, this should be possible from any module:
you can set up an interceptor directly from any module source
Since Vendure plugins are a superset of Nest modules, it should also be possible to define these global providers from plugins. However, currently they do not work due to this part of the plugin-handling code:
// Automatically add any of the Plugin's "providers" to the "exports" array. This is done
// because when a plugin defines GraphQL resolvers, these resolvers are used to dynamically
// created a new Module in the ApiModule, and if those resolvers depend on any providers,
// the must be exported. See the function {@link createDynamicGraphQlModulesForPlugins}
// for the implementation.
nestModuleMetadata.exports=[
...(nestModuleMetadata.exports||[]),
...(nestModuleMetadata.providers||[]),
];
Module(nestModuleMetadata)(target);
Attempting to define global providers will result in an error like:
[run:worker] error 22/04/21, 14:18 - [ExceptionHandler] Nest cannot export a provider/module that is not a part of the currently process
ed module (PluginWithGlobalProviders). Please verify whether the exported APP_INTERCEPTOR is available in this particular context.
[run:worker]
[run:worker] Possible Solutions:
[run:worker] - Is APP_INTERCEPTOR part of the relevant providers/imports within PluginWithGlobalProviders?
Expected behavior
Global providers should work as described in the Nest docs.
Environment (please complete the following information):
@vendure/core version: 1.0.0-beta.8
Nodejs version: any
Database (mysql/postgres etc): any
Additional context
The fix is probably to inspect the providers array and filter out the following tokens: APP_INTERCEPTOR, APP_PIPE, APP_GUARD, APP_FILTER
The text was updated successfully, but these errors were encountered:
Describe the bug
In Nest, you can define global providers such as interceptors like this:
Moreover, this should be possible from any module:
Since Vendure plugins are a superset of Nest modules, it should also be possible to define these global providers from plugins. However, currently they do not work due to this part of the plugin-handling code:
vendure/packages/core/src/plugin/vendure-plugin.ts
Lines 131 to 141 in 98e463e
Attempting to define global providers will result in an error like:
Expected behavior
Global providers should work as described in the Nest docs.
Environment (please complete the following information):
Additional context
The fix is probably to inspect the providers array and filter out the following tokens:
APP_INTERCEPTOR
,APP_PIPE
,APP_GUARD
,APP_FILTER
The text was updated successfully, but these errors were encountered: