Skip to content

German Umlaut in Maven stdout causes SAM build to fail #548

@InsertPikachuFace

Description

@InsertPikachuFace

Description:

Because the log output from the Maven build is decoded with UTF-8 (see line), an "ü" in our unit-test logs causes the SAM local Lambda build to fail.
If I add -DskipTests with a Makefile it completes as expected.

Steps to reproduce the issue:

  1. Set up Lambda project that logs out an Umlaut (äÄöÖüÜß) during maven package
  2. run sam build with default template configuration

Observed result:

 | JavaMavenWorkflow:CopySource succeeded
 | Running JavaMavenWorkflow:MavenBuild
 | JavaMavenWorkflow:MavenBuild raised unhandled exception
Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflow.py", line 369, in run
    action.execute()
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflows\java_maven\actions.py", line 39, in execute
    self.subprocess_maven.build(self.scratch_dir)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflows\java_maven\maven.py", line 31, in build
    LOG.debug("Maven logs: %s", stdout.decode("utf8").strip())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 43840: invalid start byte

Expected result:

SAM build completes despite an encoding error in a debug-log or it logs out any Maven output correctly.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Windows 10
  2. SAM CLI version: 1.96.0
  3. AWS region: EU-CENTRAL-1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions