Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Commit

Permalink
fix: runtime engine refactor compatibility (#35)
Browse files Browse the repository at this point in the history
* fix: compatible with before

* fix: context array circle
  • Loading branch information
Lellansin committed Feb 5, 2020
1 parent e358a25 commit 99ed6c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/runtime-engine/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class ServerlessBaseRuntime extends EventEmitter implements Runtime {
async emitHandler(funEvent: FunctionEvent, args) {
let newArgs = args;
if (funEvent.transformInvokeArgs) {
newArgs = funEvent.transformInvokeArgs.apply(funEvent, args) || [];
newArgs = funEvent.transformInvokeArgs.call(funEvent, args) || [];
}

const context = await this.getContext(funEvent, newArgs);
Expand Down
3 changes: 3 additions & 0 deletions packages/runtime-mock/src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export class HTTPEvent implements FunctionEvent {
}

transformInvokeArgs(context): any[] {
if (Array.isArray(context)) {
context = context.shift();
}
return [context, {}];
}
}

0 comments on commit 99ed6c5

Please sign in to comment.