@geek-fun/serverlessinsight 0.8.8 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,6 @@
9
9
  "shared": {}
10
10
  }
11
11
  },
12
- "lineage": "d5940979-1d8f-4022-880f-8e15c4c67047",
12
+ "lineage": "6263803b-7a9b-4c63-bd6d-2b651889065c",
13
13
  "serial": 5
14
14
  }
@@ -22,11 +22,11 @@
22
22
  "id": "iam-test-app-dev-sls"
23
23
  }
24
24
  ],
25
- "lastUpdated": "2026-09-08T17:59:35.725Z"
25
+ "lastUpdated": "2026-09-09T03:54:49.979Z"
26
26
  }
27
27
  }
28
28
  }
29
29
  },
30
- "lineage": "56188f6c-281d-4a4e-985b-9b7e4dab161b",
30
+ "lineage": "cd48c96b-c142-4bb9-ad37-45ae62a374d5",
31
31
  "serial": 3
32
32
  }
@@ -83,12 +83,12 @@
83
83
  "id": "test-fn"
84
84
  }
85
85
  ],
86
- "lastUpdated": "2026-09-08T18:00:08.516Z"
86
+ "lastUpdated": "2026-09-09T03:55:26.686Z"
87
87
  }
88
88
  },
89
89
  "shared": {}
90
90
  }
91
91
  },
92
- "lineage": "a4eafdb5-e34b-448c-a277-0e1527c9b410",
92
+ "lineage": "4c4e86be-cceb-4748-a6c9-f5126ae02f03",
93
93
  "serial": 4
94
94
  }
@@ -111,7 +111,7 @@
111
111
  ]
112
112
  }
113
113
  ],
114
- "lastUpdated": "2026-09-08T18:00:20.520Z",
114
+ "lastUpdated": "2026-09-09T03:55:39.018Z",
115
115
  "status": "ready"
116
116
  },
117
117
  "events.gateway_event": {
@@ -186,7 +186,7 @@
186
186
  "stageName": "RELEASE"
187
187
  }
188
188
  ],
189
- "lastUpdated": "2026-09-08T18:00:20.522Z"
189
+ "lastUpdated": "2026-09-09T03:55:39.019Z"
190
190
  }
191
191
  },
192
192
  "shared": {
@@ -205,11 +205,11 @@
205
205
  "id": "insight-poc-deploy-app-dev-sls"
206
206
  }
207
207
  ],
208
- "lastUpdated": "2026-09-08T18:00:15.518Z"
208
+ "lastUpdated": "2026-09-09T03:55:34.015Z"
209
209
  }
210
210
  }
211
211
  }
212
212
  },
213
- "lineage": "1f2dbb20-0ba7-4b2a-8ec8-63e12103d223",
213
+ "lineage": "657df5d6-2d8c-4e5c-9ff4-3bd32560eb7d",
214
214
  "serial": 2
215
215
  }
@@ -9,6 +9,6 @@
9
9
  "shared": {}
10
10
  }
11
11
  },
12
- "lineage": "7bf9db5a-0d05-4f9c-8d85-bad0750b10eb",
12
+ "lineage": "f0d40b88-0046-4b49-898f-ce1b50312659",
13
13
  "serial": 1
14
14
  }
@@ -44,12 +44,12 @@
44
44
  "serverSideEncryptionConfiguration": null
45
45
  }
46
46
  ],
47
- "lastUpdated": "2026-09-08T18:00:27.796Z"
47
+ "lastUpdated": "2026-09-09T03:55:46.801Z"
48
48
  }
49
49
  },
50
50
  "shared": {}
51
51
  }
52
52
  },
53
- "lineage": "3324775c-7bca-4588-84e4-9ae533f28646",
53
+ "lineage": "5564129a-8c36-4321-83b5-d996a4e7941d",
54
54
  "serial": 4
55
55
  }
@@ -118,7 +118,7 @@
118
118
  ]
119
119
  }
120
120
  ],
121
- "lastUpdated": "2026-09-08T17:59:12.175Z",
121
+ "lastUpdated": "2026-09-09T03:54:26.028Z",
122
122
  "status": "ready"
123
123
  }
124
124
  },
@@ -138,11 +138,11 @@
138
138
  "id": "role-reconcile-test-app-dev-sls"
139
139
  }
140
140
  ],
141
- "lastUpdated": "2026-09-08T17:59:07.174Z"
141
+ "lastUpdated": "2026-09-09T03:54:21.027Z"
142
142
  }
143
143
  }
144
144
  }
145
145
  },
146
- "lineage": "899f83f9-c924-4b09-9f3d-06d5d26ce0ad",
146
+ "lineage": "7f0a433e-535b-45c8-a718-a94b154f82ce",
147
147
  "serial": 2
148
148
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "description": "Full life cycle cross providers serverless application management for your fast-growing business.",
5
5
  "homepage": "https://serverlessinsight.com",
6
6
  "main": "dist/src/index.js",
@@ -76,6 +76,15 @@ __exportStar(require("./tablestoreOperations"), exports);
76
76
  __exportStar(require("./dnsOperations"), exports);
77
77
  __exportStar(require("./casOperations"), exports);
78
78
  __exportStar(require("./cdnOperations"), exports);
79
+ // Non-fc3 aliyun clients are synchronous management-plane RPCs — they share
80
+ // the short query-tier timeout budget (issue #234: sls ran on the SDK default
81
+ // 3s read timeout and a cold read aborted whole deploys; the deploy-tier
82
+ // budget would instead let a hung call stall a deploy for minutes).
83
+ const applyAliyunQueryTimeouts = (config) => {
84
+ config.connectTimeout = constants_1.ALIYUN_QUERY_CONNECT_TIMEOUT_MS;
85
+ config.readTimeout = constants_1.ALIYUN_QUERY_READ_TIMEOUT_MS;
86
+ return config;
87
+ };
79
88
  const initializeSdkClients = (context) => {
80
89
  const baseConfig = {
81
90
  accessKeyId: context.accessKeyId,
@@ -83,47 +92,47 @@ const initializeSdkClients = (context) => {
83
92
  regionId: context.region,
84
93
  securityToken: context.securityToken,
85
94
  };
86
- const fc3Config = new $OpenApi.Config(baseConfig);
87
- fc3Config.endpoint = `${context.accountId}.${context.region}.fc.aliyuncs.com`;
88
- fc3Config.connectTimeout = constants_1.ALIYUN_FC3_CONNECT_TIMEOUT_MS;
89
- fc3Config.readTimeout = constants_1.ALIYUN_FC3_READ_TIMEOUT_MS;
90
- const fc3Client = new fc20230330_1.default(fc3Config);
91
- const slsConfig = new $OpenApi.Config(baseConfig);
92
- slsConfig.endpoint = `${context.region}.log.aliyuncs.com`;
93
- const slsClient = new sls20201230_1.default(slsConfig);
94
- const ramConfig = new $OpenApi.Config(baseConfig);
95
- ramConfig.endpoint = 'ram.aliyuncs.com';
96
- const ramClient = new ram20150501_1.default(ramConfig);
97
- const ecsConfig = new $OpenApi.Config(baseConfig);
98
- ecsConfig.endpoint = `ecs.${context.region}.aliyuncs.com`;
99
- const ecsClient = new ecs20140526_1.default(ecsConfig);
100
- const nasConfig = new $OpenApi.Config(baseConfig);
101
- nasConfig.endpoint = `nas.${context.region}.aliyuncs.com`;
102
- const nasClient = new nas20170626_1.default(nasConfig);
95
+ const fc3Client = new fc20230330_1.default(Object.assign(new $OpenApi.Config(baseConfig), {
96
+ endpoint: `${context.accountId}.${context.region}.fc.aliyuncs.com`,
97
+ connectTimeout: constants_1.ALIYUN_FC3_CONNECT_TIMEOUT_MS,
98
+ readTimeout: constants_1.ALIYUN_FC3_READ_TIMEOUT_MS,
99
+ }));
100
+ const slsClient = new sls20201230_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
101
+ endpoint: `${context.region}.log.aliyuncs.com`,
102
+ })));
103
+ const ramClient = new ram20150501_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
104
+ endpoint: 'ram.aliyuncs.com',
105
+ })));
106
+ const ecsClient = new ecs20140526_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
107
+ endpoint: `ecs.${context.region}.aliyuncs.com`,
108
+ })));
109
+ const nasClient = new nas20170626_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
110
+ endpoint: `nas.${context.region}.aliyuncs.com`,
111
+ })));
103
112
  const ossClient = new ali_oss_1.default({
104
113
  accessKeyId: context.accessKeyId,
105
114
  accessKeySecret: context.accessKeySecret,
106
115
  region: `oss-${context.region}`,
107
116
  stsToken: context.securityToken,
108
117
  });
109
- const apigwConfig = new $OpenApi.Config(baseConfig);
110
- apigwConfig.endpoint = `apigateway.${context.region}.aliyuncs.com`;
111
- const apigwClient = new cloudapi20160714_1.default(apigwConfig);
112
- const rdsConfig = new $OpenApi.Config(baseConfig);
113
- rdsConfig.endpoint = `rds.aliyuncs.com`;
114
- const rdsClient = new rds20140815_1.default(rdsConfig);
115
- const esConfig = new $OpenApi.Config(baseConfig);
116
- esConfig.endpoint = `elasticsearch-serverless.${context.region}.aliyuncs.com`;
117
- const esClient = new es_serverless20230627_1.default(esConfig);
118
- const dnsConfig = new $OpenApi.Config(baseConfig);
119
- dnsConfig.endpoint = `alidns.aliyuncs.com`;
120
- const dnsClient = new alidns20150109_1.default(dnsConfig);
121
- const casConfig = new $OpenApi.Config(baseConfig);
122
- casConfig.endpoint = `cas.aliyuncs.com`;
123
- const casClient = new cas20200407_1.default(casConfig);
124
- const cdnConfig = new $OpenApi.Config(baseConfig);
125
- cdnConfig.endpoint = `cdn.aliyuncs.com`;
126
- const cdnClient = new cdn20180510_1.default(cdnConfig);
118
+ const apigwClient = new cloudapi20160714_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
119
+ endpoint: `apigateway.${context.region}.aliyuncs.com`,
120
+ })));
121
+ const rdsClient = new rds20140815_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
122
+ endpoint: `rds.aliyuncs.com`,
123
+ })));
124
+ const esClient = new es_serverless20230627_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
125
+ endpoint: `elasticsearch-serverless.${context.region}.aliyuncs.com`,
126
+ })));
127
+ const dnsClient = new alidns20150109_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
128
+ endpoint: `alidns.aliyuncs.com`,
129
+ })));
130
+ const casClient = new cas20200407_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
131
+ endpoint: `cas.aliyuncs.com`,
132
+ })));
133
+ const cdnClient = new cdn20180510_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
134
+ endpoint: `cdn.aliyuncs.com`,
135
+ })));
127
136
  return {
128
137
  fc3: fc3Client,
129
138
  sls: slsClient,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CLS_TOPIC_POLL_MAX_ATTEMPTS = exports.CLS_TOPIC_POLL_INTERVAL_MS = exports.SCF_STATUS_POLL_MAX_ATTEMPTS = exports.SCF_STATUS_POLL_INTERVAL_MS = exports.RAM_ROLE_PROPAGATION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_MAX_ATTEMPTS = exports.APIGW_DOMAIN_BIND_RETRY_DELAY_MS = exports.APIGW_DOMAIN_BIND_MAX_RETRIES = exports.DNS_PROPAGATION_DELAY_MS = exports.DNS_PROPAGATION_MAX_ATTEMPTS = exports.DOMAIN_BIND_RETRY_DELAY_MS = exports.DOMAIN_BIND_MAX_RETRIES = exports.STALE_LOCK_THRESHOLD = exports.DEFAULT_LOCK_RETRY_DELAY = exports.DEFAULT_LOCK_TIMEOUT = exports.LOCK_FILE_SUFFIX = exports.OSS_STATE_REQUEST_TIMEOUT_MS = exports.OSS_STATE_CONNECT_TIMEOUT_MS = exports.FC3_CODE_INLINE_SIZE_LIMIT = exports.ALIYUN_FC3_READ_TIMEOUT_MS = exports.ALIYUN_FC3_CONNECT_TIMEOUT_MS = exports.SI_LOCALSTACK_SERVER_PORT = exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
3
+ exports.CLS_TOPIC_POLL_MAX_ATTEMPTS = exports.CLS_TOPIC_POLL_INTERVAL_MS = exports.SCF_STATUS_POLL_MAX_ATTEMPTS = exports.SCF_STATUS_POLL_INTERVAL_MS = exports.RAM_ROLE_PROPAGATION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_MAX_ATTEMPTS = exports.APIGW_DOMAIN_BIND_RETRY_DELAY_MS = exports.APIGW_DOMAIN_BIND_MAX_RETRIES = exports.DNS_PROPAGATION_DELAY_MS = exports.DNS_PROPAGATION_MAX_ATTEMPTS = exports.DOMAIN_BIND_RETRY_DELAY_MS = exports.DOMAIN_BIND_MAX_RETRIES = exports.STALE_LOCK_THRESHOLD = exports.DEFAULT_LOCK_RETRY_DELAY = exports.DEFAULT_LOCK_TIMEOUT = exports.LOCK_FILE_SUFFIX = exports.OSS_STATE_REQUEST_TIMEOUT_MS = exports.OSS_STATE_CONNECT_TIMEOUT_MS = exports.FC3_CODE_INLINE_SIZE_LIMIT = exports.ALIYUN_QUERY_READ_TIMEOUT_MS = exports.ALIYUN_QUERY_CONNECT_TIMEOUT_MS = exports.ALIYUN_FC3_READ_TIMEOUT_MS = exports.ALIYUN_FC3_CONNECT_TIMEOUT_MS = exports.SI_LOCALSTACK_SERVER_PORT = exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
4
4
  exports.CODE_ZIP_SIZE_LIMIT = 300 * 1000; // 300 KB - code package size limit for inline deployment
5
5
  exports.OSS_DEPLOYMENT_TIMEOUT = 3000; // in seconds
6
6
  exports.SI_BOOTSTRAP_FC_PREFIX = 'si-bootstrap-api';
@@ -8,6 +8,10 @@ exports.SI_BOOTSTRAP_BUCKET_PREFIX = 'si-bootstrap-artifacts';
8
8
  exports.SI_LOCALSTACK_SERVER_PORT = 4567;
9
9
  exports.ALIYUN_FC3_CONNECT_TIMEOUT_MS = 120000;
10
10
  exports.ALIYUN_FC3_READ_TIMEOUT_MS = 600000;
11
+ // Query-tier budget for synchronous management-plane RPCs (all non-fc3 aliyun
12
+ // clients): fast fail beats long hang — long waits are polling loops, not calls.
13
+ exports.ALIYUN_QUERY_CONNECT_TIMEOUT_MS = 10000; // 10 seconds
14
+ exports.ALIYUN_QUERY_READ_TIMEOUT_MS = 30000; // 30 seconds
11
15
  exports.FC3_CODE_INLINE_SIZE_LIMIT = 70 * 1024 * 1024; // 70MB threshold for OSS upload
12
16
  // OSS state backend timeouts
13
17
  exports.OSS_STATE_CONNECT_TIMEOUT_MS = 10000; // 10 seconds
@@ -48,8 +48,8 @@ const getIamInfo = async (context) => {
48
48
  regionId: context.region,
49
49
  endpoint: 'ims.aliyuncs.com',
50
50
  });
51
- imsConfig.connectTimeout = constants_1.ALIYUN_FC3_CONNECT_TIMEOUT_MS;
52
- imsConfig.readTimeout = constants_1.ALIYUN_FC3_READ_TIMEOUT_MS;
51
+ imsConfig.connectTimeout = constants_1.ALIYUN_QUERY_CONNECT_TIMEOUT_MS;
52
+ imsConfig.readTimeout = constants_1.ALIYUN_QUERY_READ_TIMEOUT_MS;
53
53
  const imsClient = new ims20190815_1.default(imsConfig);
54
54
  const { body } = await imsClient.getUser(new ims20190815.GetUserRequest({ userAccessKeyId: context.accessKeyId }));
55
55
  return body?.user
@@ -803,20 +803,27 @@ const updateResource = async (context, fn, state, options) => {
803
803
  // reconcile logstore ttl/shards and index presence against what si
804
804
  // creates. Shard deficits are repaired upward; Aliyun cannot shrink.
805
805
  if (options?.force) {
806
- const liveLogstore = await client.sls.getLogstore(projectName, logstoreName);
807
- if (!liveLogstore) {
808
- logger_1.logger.warn(lang_1.lang.__('NESTED_LOGSTORE_RECREATED', { logstoreName }));
809
- await client.sls.createLogstore(projectName, logstoreName);
810
- }
811
- else if (liveLogstore.ttl !== slsOperations_1.SLS_LOGSTORE_TTL ||
812
- (liveLogstore.shardCount ?? 0) < slsOperations_1.SLS_LOGSTORE_SHARDS) {
813
- await client.sls.updateLogstore(projectName, logstoreName, slsOperations_1.SLS_LOGSTORE_TTL, Math.max(liveLogstore.shardCount ?? 0, slsOperations_1.SLS_LOGSTORE_SHARDS));
814
- logger_1.logger.info(lang_1.lang.__('NESTED_LOGSTORE_UPDATED', { logstoreName }));
806
+ // Nested repair is best-effort: a transient read/write failure here
807
+ // must not fail the function update itself (SLS ReadTimeout in prod).
808
+ try {
809
+ const liveLogstore = await client.sls.getLogstore(projectName, logstoreName);
810
+ if (!liveLogstore) {
811
+ logger_1.logger.warn(lang_1.lang.__('NESTED_LOGSTORE_RECREATED', { logstoreName }));
812
+ await client.sls.createLogstore(projectName, logstoreName);
813
+ }
814
+ else if (liveLogstore.ttl !== slsOperations_1.SLS_LOGSTORE_TTL ||
815
+ (liveLogstore.shardCount ?? 0) < slsOperations_1.SLS_LOGSTORE_SHARDS) {
816
+ await client.sls.updateLogstore(projectName, logstoreName, slsOperations_1.SLS_LOGSTORE_TTL, Math.max(liveLogstore.shardCount ?? 0, slsOperations_1.SLS_LOGSTORE_SHARDS));
817
+ logger_1.logger.info(lang_1.lang.__('NESTED_LOGSTORE_UPDATED', { logstoreName }));
818
+ }
819
+ const liveIndex = await client.sls.getIndex(projectName, logstoreName);
820
+ if (!liveIndex) {
821
+ logger_1.logger.warn(lang_1.lang.__('NESTED_INDEX_RECREATED', { logstoreName }));
822
+ await client.sls.createIndex(projectName, logstoreName);
823
+ }
815
824
  }
816
- const liveIndex = await client.sls.getIndex(projectName, logstoreName);
817
- if (!liveIndex) {
818
- logger_1.logger.warn(lang_1.lang.__('NESTED_INDEX_RECREATED', { logstoreName }));
819
- await client.sls.createIndex(projectName, logstoreName);
825
+ catch (error) {
826
+ logger_1.logger.warn(lang_1.lang.__('NESTED_REPAIR_FAILED', { resource: logstoreName, error: String(error) }));
820
827
  }
821
828
  }
822
829
  }
@@ -925,59 +932,65 @@ const updateResource = async (context, fn, state, options) => {
925
932
  // config no longer declares. Invalid config rules are skipped at create
926
933
  // time too.
927
934
  if (options?.force && fn.network) {
928
- const parseRule = (rule) => {
929
- try {
930
- return (0, ecsOperations_1.parseSecurityGroupRule)(rule);
935
+ // Best-effort: a transient SG read failure must not fail the update.
936
+ try {
937
+ const parseRule = (rule) => {
938
+ try {
939
+ return (0, ecsOperations_1.parseSecurityGroupRule)(rule);
940
+ }
941
+ catch {
942
+ return null;
943
+ }
944
+ };
945
+ const desiredIngress = (fn.network.security_group.ingress ?? [])
946
+ .map(parseRule)
947
+ .filter((r) => Boolean(r));
948
+ const desiredEgress = (fn.network.security_group.egress ?? [])
949
+ .map(parseRule)
950
+ .filter((r) => Boolean(r));
951
+ const live = await client.ecs.getSecurityGroupRules(sgInstance.id);
952
+ const liveIngressKeys = (live?.ingressRules ?? []).map((r) => (0, ecsOperations_1.canonicalSecurityGroupRule)(r.ipProtocol ?? '', r.portRange ?? '', r.sourceCidrIp ?? ''));
953
+ const liveEgressKeys = (live?.egressRules ?? []).map((r) => (0, ecsOperations_1.canonicalSecurityGroupRule)(r.ipProtocol ?? '', r.portRange ?? '', r.destCidrIp ?? ''));
954
+ const missingIngress = desiredIngress.filter((d) => !liveIngressKeys.includes((0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr)));
955
+ const missingEgress = desiredEgress.filter((d) => !liveEgressKeys.includes((0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr)));
956
+ // The extra check reuses the raw live canonical keys — the same space
957
+ // the missing check uses. Reconstructing a parsed rule here would
958
+ // collapse port ranges (80/443 -> 80) and wrongly revoke matching
959
+ // range rules.
960
+ const desiredIngressKeys = desiredIngress.map((d) => (0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr));
961
+ const desiredEgressKeys = desiredEgress.map((d) => (0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr));
962
+ const extraIngress = (live?.ingressRules ?? []).filter((r, i) => {
963
+ const key = liveIngressKeys[i];
964
+ return !key || !desiredIngressKeys.includes(key);
965
+ });
966
+ const extraEgress = (live?.egressRules ?? []).filter((r, i) => {
967
+ const key = liveEgressKeys[i];
968
+ return !key || !desiredEgressKeys.includes(key);
969
+ });
970
+ if (missingIngress.length > 0 || missingEgress.length > 0) {
971
+ await client.ecs.authorizeSecurityGroupRules(sgInstance.id, 'ingress', missingIngress);
972
+ await client.ecs.authorizeSecurityGroupRules(sgInstance.id, 'egress', missingEgress);
931
973
  }
932
- catch {
933
- return null;
974
+ if (extraIngress.length > 0 || extraEgress.length > 0) {
975
+ const toParsed = (r) => ({
976
+ // Live portRange is already in Aliyun wire format — pass verbatim
977
+ // so the revoke matches the rule exactly (ranges included).
978
+ protocol: r.ipProtocol ?? '',
979
+ cidr: r.sourceCidrIp ?? r.destCidrIp ?? '',
980
+ portRange: r.portRange ?? '',
981
+ });
982
+ await client.ecs.revokeSecurityGroupRules(sgInstance.id, 'ingress', extraIngress.map(toParsed));
983
+ await client.ecs.revokeSecurityGroupRules(sgInstance.id, 'egress', extraEgress.map(toParsed));
934
984
  }
935
- };
936
- const desiredIngress = (fn.network.security_group.ingress ?? [])
937
- .map(parseRule)
938
- .filter((r) => Boolean(r));
939
- const desiredEgress = (fn.network.security_group.egress ?? [])
940
- .map(parseRule)
941
- .filter((r) => Boolean(r));
942
- const live = await client.ecs.getSecurityGroupRules(sgInstance.id);
943
- const liveIngressKeys = (live?.ingressRules ?? []).map((r) => (0, ecsOperations_1.canonicalSecurityGroupRule)(r.ipProtocol ?? '', r.portRange ?? '', r.sourceCidrIp ?? ''));
944
- const liveEgressKeys = (live?.egressRules ?? []).map((r) => (0, ecsOperations_1.canonicalSecurityGroupRule)(r.ipProtocol ?? '', r.portRange ?? '', r.destCidrIp ?? ''));
945
- const missingIngress = desiredIngress.filter((d) => !liveIngressKeys.includes((0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr)));
946
- const missingEgress = desiredEgress.filter((d) => !liveEgressKeys.includes((0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr)));
947
- // The extra check reuses the raw live canonical keys — the same space
948
- // the missing check uses. Reconstructing a parsed rule here would
949
- // collapse port ranges (80/443 -> 80) and wrongly revoke matching
950
- // range rules.
951
- const desiredIngressKeys = desiredIngress.map((d) => (0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr));
952
- const desiredEgressKeys = desiredEgress.map((d) => (0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr));
953
- const extraIngress = (live?.ingressRules ?? []).filter((r, i) => {
954
- const key = liveIngressKeys[i];
955
- return !key || !desiredIngressKeys.includes(key);
956
- });
957
- const extraEgress = (live?.egressRules ?? []).filter((r, i) => {
958
- const key = liveEgressKeys[i];
959
- return !key || !desiredEgressKeys.includes(key);
960
- });
961
- if (missingIngress.length > 0 || missingEgress.length > 0) {
962
- await client.ecs.authorizeSecurityGroupRules(sgInstance.id, 'ingress', missingIngress);
963
- await client.ecs.authorizeSecurityGroupRules(sgInstance.id, 'egress', missingEgress);
985
+ logger_1.logger.info(lang_1.lang.__('NESTED_SG_RULES_REPAIRED', {
986
+ securityGroupId: sgInstance.id,
987
+ added: String(missingIngress.length + missingEgress.length),
988
+ removed: String(extraIngress.length + extraEgress.length),
989
+ }));
964
990
  }
965
- if (extraIngress.length > 0 || extraEgress.length > 0) {
966
- const toParsed = (r) => ({
967
- // Live portRange is already in Aliyun wire format — pass verbatim
968
- // so the revoke matches the rule exactly (ranges included).
969
- protocol: r.ipProtocol ?? '',
970
- cidr: r.sourceCidrIp ?? r.destCidrIp ?? '',
971
- portRange: r.portRange ?? '',
972
- });
973
- await client.ecs.revokeSecurityGroupRules(sgInstance.id, 'ingress', extraIngress.map(toParsed));
974
- await client.ecs.revokeSecurityGroupRules(sgInstance.id, 'egress', extraEgress.map(toParsed));
991
+ catch (error) {
992
+ logger_1.logger.warn(lang_1.lang.__('NESTED_REPAIR_FAILED', { resource: sgInstance.id, error: String(error) }));
975
993
  }
976
- logger_1.logger.info(lang_1.lang.__('NESTED_SG_RULES_REPAIRED', {
977
- securityGroupId: sgInstance.id,
978
- added: String(missingIngress.length + missingEgress.length),
979
- removed: String(extraIngress.length + extraEgress.length),
980
- }));
981
994
  }
982
995
  }
983
996
  }
@@ -1005,16 +1018,24 @@ const updateResource = async (context, fn, state, options) => {
1005
1018
  // (console deletions); extra mount targets are left alone — deleting
1006
1019
  // shared infrastructure on a reconcile is never safe.
1007
1020
  if (options?.force && fn.network) {
1008
- const fsInstances = existingInstances.filter((i) => i.type === 'ALIYUN_NAS_FILE_SYSTEM');
1009
- for (const fs of fsInstances) {
1010
- const liveTargets = await client.nas.listMountTargets(fs.id);
1011
- if (!liveTargets || liveTargets.length === 0) {
1012
- const mountPath = nasStorageItems[0]?.mount_path ?? '/mnt/nas';
1013
- const accessGroupName = `${fn.name}-${context.stage}-nas-access-${mountPath}`;
1014
- await client.nas.createMountTarget(fs.id, accessGroupName, fn.network.vpc_id, fn.network.subnet_ids[0]);
1015
- logger_1.logger.warn(lang_1.lang.__('NESTED_MOUNT_TARGET_RECREATED', { fileSystemId: fs.id }));
1021
+ // Best-effort: a transient NAS read failure must not fail the update.
1022
+ let failingFsId;
1023
+ try {
1024
+ const fsInstances = existingInstances.filter((i) => i.type === 'ALIYUN_NAS_FILE_SYSTEM');
1025
+ for (const fsEntry of fsInstances) {
1026
+ failingFsId = fsEntry.id;
1027
+ const liveTargets = await client.nas.listMountTargets(fsEntry.id);
1028
+ if (!liveTargets || liveTargets.length === 0) {
1029
+ const mountPath = nasStorageItems[0]?.mount_path ?? '/mnt/nas';
1030
+ const accessGroupName = `${fn.name}-${context.stage}-nas-access-${mountPath}`;
1031
+ await client.nas.createMountTarget(fsEntry.id, accessGroupName, fn.network.vpc_id, fn.network.subnet_ids[0]);
1032
+ logger_1.logger.warn(lang_1.lang.__('NESTED_MOUNT_TARGET_RECREATED', { fileSystemId: fsEntry.id }));
1033
+ }
1016
1034
  }
1017
1035
  }
1036
+ catch (error) {
1037
+ logger_1.logger.warn(lang_1.lang.__('NESTED_REPAIR_FAILED', { resource: failingFsId ?? 'nas', error: String(error) }));
1038
+ }
1018
1039
  }
1019
1040
  if (mountTargetInstances.length > 0 && nasStorageItems.length > 0) {
1020
1041
  nasConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "description": "Full life cycle cross providers serverless application management for your fast-growing business.",
5
5
  "homepage": "https://serverlessinsight.com",
6
6
  "main": "dist/src/index.js",