Skip to content

Commit

Permalink
fix: fp args (#561)
Browse files Browse the repository at this point in the history
Co-authored-by: Lxxyx <Lxxyxzj@gmail.com>
  • Loading branch information
echosoar and Lxxyx committed Jul 27, 2020
1 parent 8892471 commit e91983e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 3 additions & 1 deletion packages/faas-cli-plugin-invoke/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ export class FaaSInvokePlugin extends BasePlugin {
this.getAnaLysisCodeInfo();
setLock(this.buildLockPath, LOCK_TYPE.COMPLETE);
this.skipTsBuild = true;
this.setStore('skipTsBuild', true);

// for fp and oth plugin
this.setStore('skipTsBuild', true, true);
this.core.debug('Auto skip ts compile');
return;
}
Expand Down
19 changes: 13 additions & 6 deletions packages/serverless-spec-builder/registerFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const registerFunctionToIoc = (container, functionName, func) => {
(this.ctx &&
this.ctx.request &&
this.ctx.request.body &&
this.ctx.request.args) ||
this.ctx.request.body.args) ||
[];

return func.bind(bindCtx)(...args);
Expand Down Expand Up @@ -66,18 +66,25 @@ const registerFunctionToIocByConfig = (config, options) => {
}

try {
const exportMods = require(functionPath);
if (!exportMods || !exportMods[functionName]) {
const modExports = require(functionPath);
if (!modExports || !modExports[functionName]) {
return;
}

registerFunctionToIoc(
options.context,
functionHandler || `${functionName}.handler`,
exportMods[functionName]
modExports[functionName]
);
} catch {
//
} catch (error) {
console.error(
`require ${functionPath} error, function info: ${JSON.stringify(
functionInfo,
null,
2
)}`
);
console.error(error);
}
});
};
Expand Down

0 comments on commit e91983e

Please sign in to comment.