Description
We rely on the log output of our AWS Lambda tests to determine whether the tests have been successful: we log envelope and event contents and then check whether the log output looks as expected.
AWS Lambda has recently started logging a new warning when a function throws an unhandled exception. This is a scenario we're testing in some of our test cases.
The problem is that the log output is limited to the last 4kB and the new warning takes up a lot of space, so some of our events/envelopes will not fit anymore.
Some notes:
- the limit of 4kB cannot be changed
- the log level cannot be changed for the text loggers that we're using
- we're already stripping away a lot of the event contents to not run out of space
- we could consider splitting the failing tests up so that one test doesn't expect too many events
- the logs also end up in cloudwatch eventually so we could consider polling this, but it takes 5-10 minutes for them to show up there
- it should somehow be possible to set up a local AWS Lambda environment, then we wouldn't need to set up hacky ways to figure out what the SDK is doing (see e.g. https://github.com/aws/aws-sam-cli)
- do not use the logs to return captured events but actually send the events to some mock relay or something and check for the events in there (no clue now and where to run this server so the test in GH actions gets the data from the actual Lambda)
For now, we're xfailing the broken tests to get unblocked, but this needs a proper solution.