-
Notifications
You must be signed in to change notification settings - Fork 90
HelloWorldStreamFunction in examples fails with sam #1369
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
Comments
@scottgerring Please assign to me. Had a chat with Michele. |
@scottgerring We could expose this as Lambda URL, though, if this is the goal. |
the stream handlers are streaming in the java sense, not the HTTP sense - they're just there so you can read and write back from the request and response directly without any intermediate serialization happening for you. There's some doco on it here. From our perspective it's valuable to show that you can use PT with this sort of request handler too. In the example we have: powertools-lambda-java/examples/powertools-examples-core/sam/src/main/java/helloworld/AppStream.java Lines 33 to 38 in 8e4173a
If you read between the lines a bit, you could imagine that the user needs to do custom serialization on the response, so they have to use a stream handler. On the request side, they just want to deserialize things normally, so they use ObjectMapper for that. But we don't write any response! Maybe we could return something that makes it make more sense? 🤷 |
Running
sam local invoke
on any of the examples inpowertools-examples-core
and invoking the streaming variant results in an error:The issue seems to be that the streaming handler doesn't return a result at all. We should fix this, as it's a rabbit hole users may get stuck in, thinking their is something wrong with their code.
The issue seems to be this one: aws/aws-sam-cli#4656
Expected Behavior
Examples deploy and can be invoked locally with SAM without error.
Current Behavior
HelloWorldStreamFunction
example doesn't return a value, and SAM errors out for a local invoke.Possible Solution
Make the
HelloWorldStreamFunction
example code return a value.Environment
The text was updated successfully, but these errors were encountered: