sst 2.1.11 → 2.1.12
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.
- package/package.json +1 -1
- package/sst.mjs +8 -2
- package/stacks/monitor.js +6 -2
- package/support/script-function/index.mjs +13 -8
package/package.json
CHANGED
package/sst.mjs
CHANGED
|
@@ -3180,8 +3180,10 @@ async function monitor(stack) {
|
|
|
3180
3180
|
"Resource creation cancelled"
|
|
3181
3181
|
) || event.ResourceStatusReason.includes(
|
|
3182
3182
|
"Resource update cancelled"
|
|
3183
|
-
) || event.ResourceStatusReason
|
|
3183
|
+
) || event.ResourceStatusReason.includes(
|
|
3184
3184
|
"Resource creation Initiated"
|
|
3185
|
+
) || event.ResourceStatusReason.startsWith(
|
|
3186
|
+
"The following resource(s) failed to"
|
|
3185
3187
|
))
|
|
3186
3188
|
continue;
|
|
3187
3189
|
errors[event.LogicalResourceId] = event.ResourceStatusReason;
|
|
@@ -3200,7 +3202,11 @@ async function monitor(stack) {
|
|
|
3200
3202
|
"Resource creation cancelled"
|
|
3201
3203
|
) || resource.ResourceStatusReason?.includes(
|
|
3202
3204
|
"Resource update cancelled"
|
|
3203
|
-
) || resource.ResourceStatusReason?.includes(
|
|
3205
|
+
) || resource.ResourceStatusReason?.includes(
|
|
3206
|
+
"Resource creation Initiated"
|
|
3207
|
+
) || resource.ResourceStatusReason?.startsWith(
|
|
3208
|
+
"The following resource(s) failed to"
|
|
3209
|
+
))
|
|
3204
3210
|
continue;
|
|
3205
3211
|
if (resource.ResourceStatusReason)
|
|
3206
3212
|
errors[resource.LogicalResourceId] = resource.ResourceStatusReason;
|
package/stacks/monitor.js
CHANGED
|
@@ -81,7 +81,9 @@ export async function monitor(stack) {
|
|
|
81
81
|
if (event.ResourceStatusReason) {
|
|
82
82
|
if (event.ResourceStatusReason.includes("Resource creation cancelled") ||
|
|
83
83
|
event.ResourceStatusReason.includes("Resource update cancelled") ||
|
|
84
|
-
event.ResourceStatusReason
|
|
84
|
+
event.ResourceStatusReason.includes("Resource creation Initiated") ||
|
|
85
|
+
// ie. The following resource(s) failed to update: [MyResource10A5921D].
|
|
86
|
+
event.ResourceStatusReason.startsWith("The following resource(s) failed to"))
|
|
85
87
|
continue;
|
|
86
88
|
errors[event.LogicalResourceId] = event.ResourceStatusReason;
|
|
87
89
|
}
|
|
@@ -97,7 +99,9 @@ export async function monitor(stack) {
|
|
|
97
99
|
for (const resource of resources.StackResources || []) {
|
|
98
100
|
if (resource.ResourceStatusReason?.includes("Resource creation cancelled") ||
|
|
99
101
|
resource.ResourceStatusReason?.includes("Resource update cancelled") ||
|
|
100
|
-
resource.ResourceStatusReason?.includes("Resource creation Initiated")
|
|
102
|
+
resource.ResourceStatusReason?.includes("Resource creation Initiated") ||
|
|
103
|
+
// ie. The following resource(s) failed to update: [MyResource10A5921D].
|
|
104
|
+
resource.ResourceStatusReason?.startsWith("The following resource(s) failed to"))
|
|
101
105
|
continue;
|
|
102
106
|
if (resource.ResourceStatusReason)
|
|
103
107
|
errors[resource.LogicalResourceId] = resource.ResourceStatusReason;
|
|
@@ -32746,14 +32746,11 @@ function safeHandler(block) {
|
|
|
32746
32746
|
);
|
|
32747
32747
|
}
|
|
32748
32748
|
}
|
|
32749
|
-
const reason =
|
|
32750
|
-
|
|
32751
|
-
|
|
32752
|
-
|
|
32753
|
-
|
|
32754
|
-
process.env.AWS_LAMBDA_LOG_STREAM_NAME
|
|
32755
|
-
)}`
|
|
32756
|
-
].join("\n");
|
|
32749
|
+
const reason = e.reason || `${e.message} - Logs: https://${process.env.AWS_REGION}.console.aws.amazon.com/cloudwatch/home?region=${process.env.AWS_REGION}#logsV2:log-groups/log-group/${encodeURIComponent(
|
|
32750
|
+
process.env.AWS_LAMBDA_LOG_GROUP_NAME
|
|
32751
|
+
)}/log-events/${encodeURIComponent(
|
|
32752
|
+
process.env.AWS_LAMBDA_LOG_STREAM_NAME
|
|
32753
|
+
)}`;
|
|
32757
32754
|
await submitResponse("FAILED", event, { reason });
|
|
32758
32755
|
}
|
|
32759
32756
|
};
|
|
@@ -32838,6 +32835,14 @@ async function invokeUserFunction(functionName, payload) {
|
|
|
32838
32835
|
Payload: Buffer.from(JSON.stringify(payload))
|
|
32839
32836
|
})
|
|
32840
32837
|
);
|
|
32838
|
+
if (resp.FunctionError) {
|
|
32839
|
+
const payload2 = JSON.parse(Buffer.from(resp.Payload).toString());
|
|
32840
|
+
const error = new Error();
|
|
32841
|
+
error.reason = `${payload2.errorType}: ${payload2.errorMessage} - https://${process.env.AWS_REGION}.console.aws.amazon.com/cloudwatch/home?region=${process.env.AWS_REGION}#logsV2:log-groups/log-group/${encodeURIComponent(
|
|
32842
|
+
`/aws/lambda/${functionName}`
|
|
32843
|
+
)}`;
|
|
32844
|
+
throw error;
|
|
32845
|
+
}
|
|
32841
32846
|
log(`response`, resp);
|
|
32842
32847
|
}
|
|
32843
32848
|
__name(invokeUserFunction, "invokeUserFunction");
|