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(cli): trace output (-vv) is useless when files are uploaded #33104

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Jan 23, 2025

Reason for this change

When running the CDK CLI in trace mode (with -vv), e.g. cdk deploy -vv we log all SDK calls and their inputs. For file uploads, the input contains the buffer of the file to be uploaded. This results in really bad output:

[20:14:31] [sdk info] S3.PutObject({"Bucket":"cdk-hnb659fds-assets-us-east-1","Key":"220c435f80d2dd2cfc5dd0e8e29bfbb6ec58892bd813f5d6a008fdda38f6c02f.zip","Body":{"type":"Buffer","data":[80,75,3,4,20,0,8,0,8,0,0,0,33,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,100,97,116,97,46,116,120,116,75,73,44,73,52,227,2,0,80,75,7,8,165,92,116,66,8,0,0,0,6,0,0,0,80,75,1,2,45,3,20,0,8,0,8,0,0,0,33,0,165,92,116,66,8,0,0,0,6,0,0,0,8,0,0,0,0,0,0,0,0,0,32,0,164,129,0,0,0,0,100,97,116,97,46,116,120,116,80,75,5,6,0,0,0,0,1,0,1,0,54,0,0,0,62,0,0,0,0,0]},"ContentType":"application/zip","ChecksumAlgorithm":"SHA256","ServerSideEncryption":"aws:kms"}) -> OK

Now in this case we are only uploading 138 bytes. Imagine what this log looks like for files of 10MiB or 100MiB. Reportedly this also crashed every terminal.

Description of changes

There's no need to log the buffer bytes. Instead replace it with a string indicating its a buffer and the buffer length:

[20:14:31] [sdk info] S3.PutObject({"Body":"<Buffer 138 Bytes>"}) -> OK

Describe any new or updated permissions being added

n/a

Description of how you validated changes

Tests

Checklist


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

@mrgrain mrgrain requested a review from a team as a code owner January 23, 2025 20:18
@aws-cdk-automation aws-cdk-automation requested a review from a team January 23, 2025 20:18
@github-actions github-actions bot added the p2 label Jan 23, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 23, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@mrgrain mrgrain added pr-linter/exempt-integ-test The PR linter will not require integ test changes @aws-cdk/integ-tests labels Jan 23, 2025
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.

Project coverage is 81.54%. Comparing base (344d916) to head (cef26d0).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #33104      +/-   ##
==========================================
+ Coverage   81.53%   81.54%   +0.01%     
==========================================
  Files         226      227       +1     
  Lines       13769    13793      +24     
  Branches     2414     2419       +5     
==========================================
+ Hits        11227    11248      +21     
- Misses       2270     2272       +2     
- Partials      272      273       +1     
Flag Coverage Δ
suite.unit 81.54% <82.35%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 80.94% <82.35%> (+0.02%) ⬆️
packages/aws-cdk-lib/core 82.17% <ø> (ø)

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: cef26d0
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mrgrain mrgrain added pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested and removed @aws-cdk/integ-tests labels Jan 23, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review January 23, 2025 22:47

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. p2 pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants