Skip to content

Commit

Permalink
Merge pull request #18 from MozillaReality/feature/turkey-try-wrap
Browse files Browse the repository at this point in the history
wrap the lambda call to avoid pod reboot on error
  • Loading branch information
tanfarming authored Apr 25, 2022
2 parents 78fffbb + 860602b commit 2c6eb6c
Showing 1 changed file with 20 additions and 35 deletions.
55 changes: 20 additions & 35 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,30 @@ const app = express();

app.get("/thumbnail/:b64url", function(req, res) {
console.log("req.url",req.url);
try{
lambda.handler(
{
queryStringParameters: req.query,
pathParameters: {
url: req.url.replace("/thumbnail/", "")
}
},
null,
async function(something, callback) {
console.log("callback: ", callback.statusCode, callback.headers);

lambda.handler(
{
queryStringParameters: req.query,
pathParameters: {
url: req.url.replace("/thumbnail/", "")
res
.status(callback.statusCode)
.header(callback.headers)
.send(Buffer.from(callback.body, 'base64'))
}
},
null,
async function(something, callback) {
console.log("callback: ", callback.statusCode, callback.headers);

res
.status(callback.statusCode)
.header(callback.headers)
.send(Buffer.from(callback.body, 'base64'))
}
);
)
} catch (error){
console.error(error);
res.status(400)
}
});
// app.get("/thumbnail", function(req, res) {
// console.log("req.url",req.url);

// lambda.handler(
// {
// queryStringParameters: req.query,
// pathParameters: {
// url: req.url.replace("/thumbnail", "")
// }
// },
// null,
// async function(something, callback) {
// console.log("callback: ", callback.statusCode, callback.headers);
// res
// .status(callback.statusCode)
// .header(callback.headers)
// .send(callback.body)
// }
// );
// });
app.listen(5000, function() {
console.log("listening on :5000");
});

0 comments on commit 2c6eb6c

Please sign in to comment.