Skip to content

Commit

Permalink
fix: npe for faas (#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 authored Mar 24, 2021
1 parent 6883400 commit 8c062f9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/faas/src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,16 @@ export class MidwayFaaSFramework extends BaseFramework<
this.getApplicationContext().registerDataHandler(
PLUGIN_KEY,
(key, meta, target) => {
return target[REQUEST_OBJ_CTX_KEY]?.[key] || this.app[key];
return target?.[REQUEST_OBJ_CTX_KEY]?.[key] || this.app[key];
}
);

this.getApplicationContext().registerDataHandler(
LOGGER_KEY,
(key, meta, target) => {
return target[REQUEST_OBJ_CTX_KEY]?.['logger'] || this.app.getLogger();
return (
target?.[REQUEST_OBJ_CTX_KEY]?.['logger'] || this.app.getLogger()
);
}
);
}
Expand Down

0 comments on commit 8c062f9

Please sign in to comment.