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

[V2] API Gateway PutRestApi Bug #5053

Closed
starkshaw opened this issue Mar 9, 2020 · 2 comments
Closed

[V2] API Gateway PutRestApi Bug #5053

starkshaw opened this issue Mar 9, 2020 · 2 comments
Assignees
Labels
duplicate This issue is a duplicate. guidance Question that needs advice or information.

Comments

@starkshaw
Copy link

In AWS CLI v2, using PutRestApi to update API via a JSON Swagger file would end up an Invalid Base64 error.

With --debug parameter turned on, here are what happened:

2020-03-09 22:54:30,811 - MainThread - botocore.endpoint - DEBUG - Setting apigateway timeout as (60, 60)
2020-03-09 22:54:30,813 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.api-gateway.PutRestApi: calling handler <function base64_decode_input_blobs at 0x108875e50>
2020-03-09 22:54:30,813 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/awscli/customizations/binaryformat.py", line 59, in _visit_scalar
    parent[name] = base64.b64decode(value)
  File "/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/awscli/clidriver.py", line 335, in main
    return command_table[parsed_args.command](remaining, parsed_args)`

It seems to me that AWS CLI v2 does not transform the JSON payload to Base64. This issue would not happened on AWS CLI v1.

This issue would be resolved if I use another command to encode the JSON payload to Base64 and put that after the --body parameter.

@klaytaybai klaytaybai added the duplicate This issue is a duplicate. label Mar 11, 2020
@klaytaybai
Copy link

Hi @starkshaw, this seems to be a duplicate of some other customer feedback. You can learn more about this change in our V1-V2 breaking changes doc.

Also check out some other issues:
#5011
#4994
#4978
https://github.com/aws/aws-cli/pull/4981/files

@klaytaybai klaytaybai added closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information. labels Mar 11, 2020
@klaytaybai klaytaybai self-assigned this Mar 11, 2020
@starkshaw
Copy link
Author

Thanks!

@no-response no-response bot removed the closing-soon This issue will automatically close in 4 days unless further comments are made. label Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue is a duplicate. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

2 participants