Skip to content

Conversation

ShadowCat567
Copy link
Contributor

@ShadowCat567 ShadowCat567 commented Jul 15, 2025

Description of changes

Migrating:

  • amplify-category-storage
  • amplify-util-import (completing migration)
  • amplify-provider-awscloudformation

Something you may notice in this PR is there are some new functions that convert streams to something else, this is because the Body field within GetObjectCommand is now a ReadableStream, where as in getObject it had a more flexible type which allowed it to be a string or a Buffer as well as a stream.
Changes the way credentials are handled to use the V3-style object instead of the V2-style one

This includes a lot of high risk changes, will need additional testing

Issue #, if available

Description of how you validated changes

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

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

}
return reject(updateErr);
}
cfnModel.waitFor(cfnCompleteStatus, cfnStackCheckParams, async (completeErr) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

need some additional feedback on this section

Copy link
Contributor

@sobolk sobolk left a comment

Choose a reason for hiding this comment

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

LGTM. Please make workflows/checks happy.

Comment on lines 50 to 51
args.push('--debug');

Copy link
Contributor

Choose a reason for hiding this comment

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

Here and in other places.
I'm assuming this will get removed in final version of PR.
In general we should be running tests without it. To make sure that command without it works as expected (there's always small risk that debug flag might alter logic - if that happens it would be unwanted regression).

For test debugging the alternative is to set env var mentioned here

export const isDebug = process.argv.includes('--debug') || process.env.AMPLIFY_ENABLE_DEBUG_OUTPUT === 'true';
.
in the workflow definition or codebuild build. (there's probably no automation/runbook for it yet, but should be possible).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, if you see any --debug or console.log statements, those are relics from testing

@@ -70,7 +79,7 @@ export class Lambda {
}

try {
await Promise.all(deletionPromises);
await Promise.all(deletionPromises.map((fn) => fn()));
Copy link
Contributor

Choose a reason for hiding this comment

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

is this .map necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe not, I'll check

Comment on lines 17 to 24
const streamToString = async (stream: Readable) => {
const chunks = [];
for await (const chunk of stream) {
chunks.push(Buffer.from(chunk));
}
return Buffer.concat(chunks).toString('utf-8');
};

Copy link
Contributor

Choose a reason for hiding this comment

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

There is import { text } from 'node:stream/consumers'; that could be used for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

'node:stream/consumers' only works with node versions 16+, we have some packages that have @types/node set to 12, which seem to be blocking us from using this

Copy link
Contributor

Choose a reason for hiding this comment

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

you can try upgrading @types/node. The runtimes we're using now are 20+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants