@jaypie/express 1.2.4-rc16 → 1.2.4-rc17
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/dist/cjs/index.cjs +33 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +33 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -934,6 +934,7 @@ function runExpressApp(app, req, res) {
|
|
|
934
934
|
*/
|
|
935
935
|
function createLambdaHandler(app, _options) {
|
|
936
936
|
return async (event, context) => {
|
|
937
|
+
let result;
|
|
937
938
|
try {
|
|
938
939
|
// Set current invoke for getCurrentInvokeUuid
|
|
939
940
|
setCurrentInvoke(event, context);
|
|
@@ -943,8 +944,38 @@ function createLambdaHandler(app, _options) {
|
|
|
943
944
|
const res = new LambdaResponseBuffered();
|
|
944
945
|
// Run Express app
|
|
945
946
|
await runExpressApp(app, req, res);
|
|
946
|
-
//
|
|
947
|
-
|
|
947
|
+
// Get Lambda response - await explicitly to ensure we have the result
|
|
948
|
+
result = await res.getResult();
|
|
949
|
+
// Debug: Log the response before returning
|
|
950
|
+
console.log("[createLambdaHandler] Returning response:", JSON.stringify({
|
|
951
|
+
statusCode: result.statusCode,
|
|
952
|
+
headers: result.headers,
|
|
953
|
+
bodyLength: result.body?.length,
|
|
954
|
+
isBase64Encoded: result.isBase64Encoded,
|
|
955
|
+
}));
|
|
956
|
+
return result;
|
|
957
|
+
}
|
|
958
|
+
catch (error) {
|
|
959
|
+
// Log any unhandled errors
|
|
960
|
+
console.error("[createLambdaHandler] Unhandled error:", error);
|
|
961
|
+
if (error instanceof Error) {
|
|
962
|
+
console.error("[createLambdaHandler] Stack:", error.stack);
|
|
963
|
+
}
|
|
964
|
+
// Return a proper error response instead of throwing
|
|
965
|
+
return {
|
|
966
|
+
statusCode: 500,
|
|
967
|
+
headers: { "content-type": "application/json" },
|
|
968
|
+
body: JSON.stringify({
|
|
969
|
+
errors: [
|
|
970
|
+
{
|
|
971
|
+
status: 500,
|
|
972
|
+
title: "Internal Server Error",
|
|
973
|
+
detail: error instanceof Error ? error.message : "Unknown error occurred",
|
|
974
|
+
},
|
|
975
|
+
],
|
|
976
|
+
}),
|
|
977
|
+
isBase64Encoded: false,
|
|
978
|
+
};
|
|
948
979
|
}
|
|
949
980
|
finally {
|
|
950
981
|
// Clear current invoke context
|