Meris Tarhanis
05/10/2022, 12:58 PMimport * as debug from "./debug";
import Sentry from "@sentry/serverless";
const handler = Sentry.AWSLambda.wrapHandler((lambda) => {
return async function (event, context) {
let body;
let statusCode;
// Start debugger
debug.init(event);
try {
// Run the Lambda
body = await lambda(event, context);
statusCode = body.statusCode || 200;
} catch (e) {
// Print debug messages
debug.flush(e);
body = { error: e.message };
statusCode = 500;
}
// Return HTTP response
return {
statusCode,
body: JSON.stringify(body),
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*',
// "Access-Control-Allow-Credentials": true,
// "Access-Control-Allow-Methods": "GET, PUT, POST, DELETE, HEAD, OPTIONS",
},
};
};
})
export default handler
This function is used by other lambda's to handle API calls, and my problem is that currently It's just sending the REQUEST's but it doesn't return any RESPONSE. Maybe it's something minor that I am missing. If you need any more info I would happily supply.thdxr
05/10/2022, 1:25 PMwrapHandler
INSIDE the functionthdxr
05/10/2022, 1:25 PMreturn wrapHandler(async function() { ... })
Meris Tarhanis
05/10/2022, 1:36 PMMeris Tarhanis
05/10/2022, 1:56 PMimport * as debug from "./debug";
import Sentry from "@sentry/serverless";
export default function handler(lambda) {
return Sentry.AWSLambda.wrapHandler(async function (event, context) {
let body;
let statusCode;
// Start debugger
debug.init(event);
try {
// Run the Lambda
body = await lambda(event, context);
statusCode = body.statusCode || 200;
} catch (e) {
// Print debug messages
debug.flush(e);
body = { error: e.message };
statusCode = 500;
}
// Return HTTP response
return {
statusCode,
body: JSON.stringify(body),
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*',
// "Access-Control-Allow-Credentials": true,
// "Access-Control-Allow-Methods": "GET, PUT, POST, DELETE, HEAD, OPTIONS",
},
};
}
)
}
thdxr
05/10/2022, 2:07 PMMeris Tarhanis
05/10/2022, 2:12 PMthdxr
05/10/2022, 2:43 PMMeris Tarhanis
05/10/2022, 2:45 PMthdxr
05/10/2022, 2:45 PMthdxr
05/10/2022, 2:46 PMFrank
It’s just sending the REQUEST’s but it doesn’t return any RESPONSEDoes this happen on
sst start
or sst deploy
?Meris Tarhanis
05/12/2022, 1:39 PMsst deploy
Frank
Meris Tarhanis
05/12/2022, 3:44 PM{
"requestTime": "10/May/2022:19:34:56 +0000",
"requestId": "R7KvGhE-liAEMRw=",
"httpMethod": "GET",
"path": "/appointments/patients/59EB6565-DCD2-4676-831C-C0B5F67F6FD2",
"routeKey": "GET /appointments/patients/{person_guid}",
"status": 500,
"responseLatency": 465,
"integrationRequestId": "4600c62d-5ac3-437c-b175-3a17795c5f08",
"integrationStatus": "500",
"integrationLatency": "457",
"integrationServiceStatus": "200",
"ip": "87.116.165.251",
"userAgent": "PostmanRuntime/7.28.4",
"cognitoIdentityId": "-"
}
the usual response, do you need more insight?Meris Tarhanis
05/12/2022, 4:16 PM