willfarrell on main
Use aws-sdk submodule Update index.d.ts Add all references and 1 more (compare)
const handler = middy(awesomeLogic)
.use(jsonBodyParser())
.use(cors());
export default handler;
async function awesomeLogic(evt, ctx) {
// typeof evt.body === "string"
// it's a POST evt with content-type: application/json
}
typeof evt.body === "object"
httpHeaderNormalizer
middleware before the jsonBodyParser
.
Cannot destructure property
httpContentNegotiationof 'undefined' or 'null'
error?
import middy from 'middy'
const {
httpContentNegotiation,
httpErrorHandler
} = middy.middlewares
const lovelyStuff = event => {
// do stuff
}
const handler = middy(lovelyStuff)
.use(httpContentNegotiation({ availableMediaTypes: ['application/json'] }))
.use(jsonBodyParser())
.use(httpErrorHandler())
export { handler }
'Event object failed validation'
would be possibly safer