Skip to content

Commit

Permalink
Do not try to call onRequest on non-object providers
Browse files Browse the repository at this point in the history
Signed-off-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
  • Loading branch information
ardatan committed Nov 7, 2018
1 parent ef146af commit c70b9f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/core/src/di/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ export class Injector {

const instance = this.getByProvider(provider);

if (instance && 'onRequest' in instance) {
if (
instance &&
typeof instance !== 'string' &&
typeof instance !== 'number' &&
'onRequest' in instance
) {
return instance.onRequest(request, context, appModule);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/graphql-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface GraphQLModuleOptions<Config, Request, Context> {
* the module's name.
* You can use this later with `@Inject` in your `Provider`s.
*
* @param name - the name of the module
* @param module
* @constructor
*/
export const ModuleConfig = (module: string | GraphQLModule) =>
Expand Down

0 comments on commit c70b9f9

Please sign in to comment.