Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error message when returning a payload above the Lambda limits #1483

Merged
merged 6 commits into from
Mar 26, 2023

Conversation

mnapoli
Copy link
Member

@mnapoli mnapoli commented Mar 24, 2023

Fix #1368, also reported in Slack.

Before, when returning a response above the Lambda limits (6MB), users would get the following logs:

image

  • 413 error (payload too large)
  • then 403 error when reporting the execution status (I am guessing this is because the execution is already failed by the previous failed call, so this is redundant and rejected by the Runtime API)

This PR improves this specific error so that it's much clearer:

image

On top of that, the PR also adds low-level details for other Runtime API errors. This lets us more easily debug/understand what went wrong. In our example, it helps us understand the second error (403):

image

Thanks to that, we now know that after a 413 we shouldn't call the "signal failure" API. That removes the second error:

image

Positive side-effect: the runtime is no longer in an unknown state (because of unknown errors) and it will not restart PHP-FPM + the whole runtime 💪

@mnapoli mnapoli added the bug label Mar 24, 2023
@mnapoli mnapoli marked this pull request as ready for review March 24, 2023 15:23
@mnapoli mnapoli marked this pull request as draft March 24, 2023 15:34
@mnapoli
Copy link
Member Author

mnapoli commented Mar 24, 2023

Still need to figure out why the execution is marked as successful in metrics 🤔

@mnapoli mnapoli mentioned this pull request Mar 25, 2023
If we do, we get an error response from the Lambda Runtime API:

```
InvalidStateTransition: State transition from RuntimeResponseSentState to InvocationErrorResponse failed for runtime. Error: State transition is not allowed
```
@mnapoli
Copy link
Member Author

mnapoli commented Mar 26, 2023

Still need to figure out why the execution is marked as successful in metrics 🤔

It turns out that's an intentional behavior, that's how the NodeJS runtime behaves.

It seems impossible (unless we catch size > 6MB but what if the limit changes?) to prevent, so we'll go with that.

@mnapoli mnapoli marked this pull request as ready for review March 26, 2023 15:25
@mnapoli mnapoli merged commit c7835e5 into master Mar 26, 2023
@mnapoli mnapoli deleted the lambda-runtime-errors branch March 26, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

403 for Lambda Runtime
1 participant