Compare commits

..

1 Commits

Author SHA1 Message Date
千风 c49e9b957a fix: fix async invoke withour stateul invoke id error 2021-12-31 09:50:03 +08:00
5 changed files with 25 additions and 41 deletions

44
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "fc-remote-invoke",
"version": "0.0.23",
"version": "0.0.20",
"description": "This is a component demo for Serverless Devs Tool ",
"keywords": [
"Serverless",

View File

@ -2,7 +2,7 @@ Type: Component
Name: fc-remote-invoke
Provider:
- 其它
Version: 0.0.23
Version: 0.0.21
Description: 初始化component模板
HomePage: https://www.serverless-devs.com
Tags: #标签详情

View File

@ -15,7 +15,6 @@ export default class FcRemoteInvoke {
async invoke(inputs: InputProps): Promise<any> {
const {
props,
timeout,
eventPayload,
credentials,
isHelp,
@ -32,7 +31,7 @@ export default class FcRemoteInvoke {
let fcClient;
if (!props.domainName) {
const fcCommon = await core.loadComponent('devsapp/fc-common');
fcClient = await fcCommon.makeFcClient({ ...inputs, props: { region: props.region, timeout }});
fcClient = await fcCommon.makeFcClient({ ...inputs, props: { region: props.region }});
}
const remoteInvoke = new RemoteInvoke(fcClient, credentials.AccountID);
await remoteInvoke.invoke(props, eventPayload, { invocationType, statefulAsyncInvocationId });
@ -52,7 +51,6 @@ export default class FcRemoteInvoke {
const parsedArgs: {[key: string]: any} = core.commandParse({ ...inputs, args }, {
boolean: ['help', 'event-stdin'],
number: ['timeout'],
string: ['invocation-type', 'event', 'event-file', 'region', 'domain-name','service-name', 'function-name', 'qualifier', 'stateful-async-invocation-id'],
alias: {
'help': 'h',
@ -110,20 +108,8 @@ export default class FcRemoteInvoke {
throw new Error('region/serviceName(service-name)/functionName(function-name) can not be empty.');
}
// 超时时间获取的原理https://github.com/devsapp/fc/issues/480
const propsTimeout = argsData.timeout || inputs.props?.timeout;
let timeout = 600;
if (_.isNumber(propsTimeout)) {
if (_.isEmpty(inputs.props?.runtime) || inputs.props?.runtime === 'custom-container') {
timeout = propsTimeout + 7 * 60;
} else {
timeout = propsTimeout + 2 * 60;
}
}
return {
props,
timeout,
credentials: inputs.credentials,
eventPayload,
isHelp: false,

View File

@ -25,10 +25,8 @@ export interface IProperties {
region: string;
serviceName: string;
functionName: string;
runtime?: string;
qualifier?: string;
domainName?: string;
timeout?: string;
}
export function isProperties(args: any): args is IProperties {
if (!args) {