Closed zoladkow closed 11 months ago
Oh, my bad! I just noticed, that maven.py
was fixed JUST TWO DAYS ago 🤯 as part of https://github.com/aws/aws-lambda-builders/pull/554
I think I assumed it must have been fixed a long time ago since #1164 was from 2020, was already closed and contained some PRs. but those were only for .NET workflow - so not even directly related to that issue 🤦♂️
Hi thanks for opening this issue. The Lambda Builders PR you've linked does indeed fix the crashing, but you bring up a good point in your OP about using errors="replace"
. The linked fix doesn't utilize that argument, so its a good thing you opened this issue (even if it might be a duplicate/fixed already)!
I'll keep this issue open in the mean time to see if we can use that argument to better improve our logs.
Patch is released in v1.99.0. Closing
Description:
This issue is not about the original encoding handling problem, but the fact, that current installer does not include the package which seems to fix that issue.
sam build
fails withError: JavaMavenWorkflow:MavenBuild - 'utf-8' codec can't decode byte 0xdf in position 76813: invalid continuation byte
.--debug
shows the error originates from\aws_lambda_builders\workflows\java_maven\maven.py", line 31
which is this:LOG.debug("Maven logs: %s", stdout.decode("utf8").strip())
This is weird as there are preexisting issues (ie. #1164 ) related to this, which got closed already. And fun fact is, that the
aws_lambda_builders
included with CLI installer does not seem to be the same as current content of the repository for that package. at leastmaven.py
now uses an util for decoding maven output, instead direcly usingdecode()
with hardcodedutf-8
.Steps to reproduce:
sam.cmd build Function --template project\.aws-sam\temp-template.yaml --build-dir project\.aws-sam\build
Observed result:
SAM build fails after Maven finishes successfully:
If, however, I update the installed
maven.py
to sayLOG.debug("Maven logs: %s", stdout.decode(encoding="utf8", errors="replace").strip())
the whole build passes without issue, also cannot identify where the replacement was done.Expected result:
I'd expect Maven output to be copied as-is, and in general, console output encoding should have no impact on the build process...
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 1.98.0sam --info