Enable propogation of fatal errors through io.Reader responses
@bmoffatt is already working on this.
Since May 7, 2023.
Assessment
This issue has not been assessed yet.
Description
Is your feature request related to a problem? Please describe.
A handler can gracefully force the process to be restarted by returning a messages.InvokeResponse_Error with ShouldExit = true. The usual way this happens is when the function panics, but pass-through is allowed too on the handler's error value https://github.com/aws/aws-lambda-go/blob/caace586bdec3652223cc7761cc8c1c155a85601/lambda/errors.go#L20-L22
However, there's not an equivalent when the response value is a reader.
Describe the solution you'd like
Goal should be able to make this:
type fatalReader struct{}
func (r *fatalReader) Read(_ []byte) (int, error) {
return 0, messages.InvokeResponse_Error{Type: "IDK", Message: "fatal", ShouldExit: true}
}
func handler() (any, error) {
return fatalReader{}, nil
}
result in the same logging and error reporting as this:
func hander() (any, error) {
return nil, messages.InvokeResponse_Error{Type: "IDK", Message: "fatal", ShouldExit: true}
}
Describe alternatives you've considered
Might also expose something like https://github.com/aws/aws-lambda-go/blob/caace586bdec3652223cc7761cc8c1c155a85601/lambda/errors.go#L35-L46 in the public API, to make the construction of these fatal errors easier.
- Dominant language
- Go
- Stars
- 3.8k
- Forks
- 578
- Avg merge
- 16h 56m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/aws-lambda-go
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
aws/aws-lambda-go#634 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws/aws-lambda-go#597 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
aws/aws-lambda-go#556 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
aws/aws-lambda-go#610 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
aws/aws-lambda-go#598 ·
All issues in aws/aws-lambda-go
Similar issues
-
kind/bug needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 72/100
matrixorigin/matrixone#29223 ·
-
needs-acceptance wg/data-plane-networking
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vllm-project/semantic-router#4024 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
alexgorbatchev/dotfiles#107 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100