harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
35 stars 30 forks source link

Stream export payloads, so that we get a bigger quota #2058

Closed rebeccacremona closed 1 month ago

rebeccacremona commented 1 month ago

As per https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html:

Response stream payloads have a soft limit of 20 MB as compared to the 6 MB limit for buffered responses.

This PR switches our code to call invoke_with_response_stream instead of plain invoke, and then adapts to the new response format.

I could not get anything similar working locally with the AWS Lambda Runtime Emulator that we are using. So, unfortunately, the branch of our code that talks to real AWS now differs even more substantially than before. But... I do not currently know of an alternative.

Our test suite, run through the emulator, is still useful: it proves that the lambda function itself works, even if it can't prove that our invocation of it will be correct in production, or that our error handling works.

For this PR, I have tested that locally by configuring my dev setup to talk directly to the real, deployed lambda function. I tested with:

So, I think we can be fairly confident that this is safe to deploy.

We should reconsider this whole setup 😄.