CodeGenieApp / CodeGenieApp/serverless-express
Unhandled Promise Rejection on ALB event
- Dominant language
- JavaScript
- Stars
- 5.3k
- Forks
- 676
- PR merge metrics
- No merged PRs in 30d
Description
Given an ALB event with multiValueQueryStringParameters but one of the value fails `decodeURIComponent` , the promise isnt handled at all. Expectation is that it should return an error and consumers treat that error
https://github.com/CodeGenieApp/serverless-express/blob/1376bd01e29f6bcf911f86a2b17a5cb85b2844ec/src/event-sources/aws/alb.js#L40
https://github.com/CodeGenieApp/serverless-express/blob/1376bd01e29f6bcf911f86a2b17a5cb85b2844ec/src/event-sources/aws/alb.js#L17
The below test wont even report the failure since the promise is left unhandled
```
test('serverlessExpressInstance should throw', async () => {
const multiValueQueryStringParameters = { etype: ['odp'], passurl: ['/category/'], template: ['../../../../../../../../../etc/passwd%%0000.html'] }
const event = makeEvent({
eventSourceName: 'alb',
path: '/',
httpMethod: 'GET',
multiValueQueryStringParameters
})
await expect(serverlessExpressInstance(event)).toThrow('some')
})
```

Contributor guide
Assessment
This issue has not been assessed yet.