willfarrell on 4.2.3
willfarrell on main
chore: version bump chore: version bump (compare)
willfarrell on main
Fix setDimensions function arg … fix: run linter fix: fix cloudwatch-metrics uni… and 2 more (compare)
ssm
middleware that is part of the core for ideas. My middleware works fine when I remove that single async call to S3. But with it I keep getting UnhandledPromiseRejectionWarning
Hey all! Is there any preferred way of reusing a configured set of middlewares?
I have a handler configured:
const handler = middy(async (event, context, callback) => {
(...)
callback(null, { });
});
handler.use(middleware1())
handler.use(middleware2())
handler.use(middleware3())
handler.use(middleware4())
module.exports = { handler };
I'm looking for a good way of only having to specify something like:
const handler = withMiddlewares(async (event, context, callback) => {
(...)
callback(null, { });
});
module.exports = { handler };
Where the handler is pre-configured with a bunch of middlewares.
I'm trying to avoid duplicating a bunch of handler configurations that are all going to be the same / similar.
Cheers!
middy
and httpErrorHandler
middleware. I am using AWS Lambdas through an API Gateway, I have wrapped my handler in a middy()
function and also applied the middlewares with .use()
. When I need to throw an error inside my Lambda handler, I use the createError
method from the http-errors
library. But for some reason, the lambda response is always a 502
with {"message": "Internal server error"}
. Am I missing something?