sst 2.1.11 → 2.1.13

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.
@@ -32746,14 +32746,11 @@ function safeHandler(block) {
32746
32746
  );
32747
32747
  }
32748
32748
  }
32749
- const reason = [
32750
- e.message,
32751
- `Logs: https://${process.env.AWS_REGION}.console.aws.amazon.com/cloudwatch/home?region=${process.env.AWS_REGION}#logsV2:log-groups/log-group/${encodeURIComponent(
32752
- process.env.AWS_LAMBDA_LOG_GROUP_NAME
32753
- )}/log-events/${encodeURIComponent(
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");