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

Fix: sam invoke local throw error 'utf-8' codec can't decode byte 0xff #6559

Merged
merged 4 commits into from
Jan 17, 2024

Conversation

sidhujus
Copy link
Contributor

Which issue(s) does this change fix?

#6369

Why is this change necessary?

The code was previously refactored to use Strings to handle the IO related to sam local invoke and sam local start-lambda this fixed some issues where certain strings werent displayed correctly, but broke the functionality to support lambdas returning images

How does it address the issue?

adds an extra BytesIO object to the stream writer and checks if it was written to in order to determine if it should return strings or the bytes

What side effects does this change have?

Mandatory Checklist

PRs will only be reviewed after checklist is complete

  • Add input/output type hints to new functions/methods
  • Write design document if needed (Do I need to write a design document?)
  • Write/update unit tests
  • Write/update integration tests
  • Write/update functional tests if needed
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sidhujus sidhujus requested a review from a team as a code owner January 15, 2024 19:29
@@ -7,6 +7,6 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: main.image_handler
Runtime: python3.12
Runtime: python3.11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we ever find a root cause for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we make the request to lambda it only ever returns a 502, provided the host machine is windows and the lambda is returning raw bytes. I assume that it's because a bug between docker and the python 3.12 runtime but I wasn't able to narrow it down further than that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could that be docker version limitation for these new (al2023 based) runtimes? Were you able to run the tests on a Windows machine with newer Docker version to see if these tests are passing or not?

@sidhujus sidhujus added this pull request to the merge queue Jan 17, 2024
Merged via the queue into aws:develop with commit 7ba03d6 Jan 17, 2024
55 checks passed
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.

3 participants