Skip to content

Getting character encoding error with awscli v2 #6288

Closed

Description

@iamyogeshg

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
aws lambda cli command giving incomplete json as output and complains of character encoding.

SDK version number
aws-cli/2.2.21 Python/3.8.8 Linux/5.10.25-linuxkit exe/x86_64.alpine.3 prompt/off

Platform/OS/Hardware/Device
Linux Alpine
/workdir # uname -a
Linux 3c8704d9831e 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64 Linux

To Reproduce (observed behavior)

  1. Have any aws lambda
  2. aws lambda get-function-configuration --function-name <> --profile=<> --region ap-southeast-2

Expected behavior
Should give complete output of lambda function config

Logs/output

2021-07-21 06:44:30,566 - MainThread - botocore.hooks - DEBUG - Event needs-retry.lambda.GetFunctionConfiguration: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x7f433a35d070>>
2021-07-21 06:44:30,566 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2021-07-21 06:44:30,567 - MainThread - botocore.hooks - DEBUG - Event after-call.lambda.GetFunctionConfiguration: calling handler <bound method RetryQuotaChecker.release_retry_quota of <botocore.retries.standard.RetryQuotaChecker object at 0x7f433a39cbb0>>
2021-07-21 06:44:30,567 - MainThread - awscli.formatter - DEBUG - RequestId: 520fe9f6-806f-46aa-9830-cb8c8bbe98eb
2021-07-21 06:44:30,568 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "awscli/clidriver.py", line 459, in main
  File "awscli/clidriver.py", line 594, in __call__
  File "awscli/clidriver.py", line 770, in __call__
  File "awscli/clidriver.py", line 903, in invoke
  File "awscli/clidriver.py", line 925, in _display_response
  File "awscli/formatter.py", line 88, in __call__
  File "awscli/formatter.py", line 107, in _format_response
  File "json/__init__.py", line 180, in dump
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 108: ordinal not in range(128)

'ascii' codec can't encode character '\u2019' in position 108: ordinal not in range(128)
parse error: Unfinished JSON term at EOF at line 45, column 45

Additional context
Actually produced with any output - json or text doesn't matter. It could be similar to #5558 but setting set PYTHONIOENCODING=UTF-8 did not help. I am not sure if this is also applicable for linux alpine distro.

Activity

  1. changed the title [-]Getting character encoding error with awscli v1 [/-] [+]Getting character encoding error with awscli v2[/+] on Jul 21, 2021
  2. iamyogeshg commented on Jul 21, 2021

    @iamyogeshg
    Author

    So one of the tags in lambda for eg, MSG_TEMPLATE was set to "We're open". If we change this tag to "We are open", awscli output works fine.

    Closing the issue for now.

  3. github-actions commented on Jul 21, 2021

    @github-actions
    Contributor

    ⚠️COMMENT VISIBILITY WARNING⚠️

    Comments on closed issues are hard for our team to see.
    If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions