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

Avoid importing full root @pulumi/aws module #2569

Merged
merged 1 commit into from
Jun 23, 2023
Merged

Conversation

lukehoban
Copy link
Member

Every folder inside the AWS Node.js SDK that has a mixin was importing "../utils", which imports "./awsMixins" which itself was forcing import of "." which then goes back and tries to force import of everything. There is no clear reason why forcing this root module import was ever necesary. Nothing that imports utils.ts depends on the side effects caused by "awsMixins", and the primary effect of adding the sdk getter onto the root module is only relevant if the end user loads that root module itself so they can access this property.

Also expands some existing test coverage to test this and use of aws.sdk, which is the related feature that could in principle be impacted by removing this forced side effect

Fixes #772.

Every folder inside the AWS Node.js SDK that has a mixin was importing "../utils", which imports "./awsMixins" which itself was forcing import of "." which then goes back and tries to force import of everything.  There is no clear reason why forcing this root module import was ever necesary. Nothing that imports utils.ts depends on the side effects caused by "awsMixins", and the primary effect of adding the `sdk` getter onto the root module is only relevant if the end user loads that root module itself so they can access this property.

Also expands some existing test coverage to test this and use of `aws.sdk`, which is the related feature that could in principle be impacted by removing this forced side effect

Fixes #772.
@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

1 similar comment
@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link
Contributor

@rquitales rquitales left a comment

Choose a reason for hiding this comment

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

This change looks reasonable. Thanks for updating a test for this as well.

@lukehoban lukehoban merged commit a78d82e into master Jun 23, 2023
18 checks passed
@lukehoban lukehoban deleted the lukehoban/772 branch June 23, 2023 18:53
@bradleyayers
Copy link

Just ran into this myself, thanks for fixing this @lukehoban! Looks like this hasn't made its way into a release yet, I'll use a local patch in the mean time.

iwahbe pushed a commit that referenced this pull request Jul 12, 2023
Every folder inside the AWS Node.js SDK that has a mixin was importing "../utils", which imports "./awsMixins" which itself was forcing import of "." which then goes back and tries to force import of everything.  There is no clear reason why forcing this root module import was ever necesary. Nothing that imports utils.ts depends on the side effects caused by "awsMixins", and the primary effect of adding the `sdk` getter onto the root module is only relevant if the end user loads that root module itself so they can access this property.

Also expands some existing test coverage to test this and use of `aws.sdk`, which is the related feature that could in principle be impacted by removing this forced side effect

Fixes #772.
iwahbe pushed a commit that referenced this pull request Jul 13, 2023
* Avoid importing full root `@pulumi/aws` module (#2569)

Every folder inside the AWS Node.js SDK that has a mixin was importing "../utils", which imports "./awsMixins" which itself was forcing import of "." which then goes back and tries to force import of everything.  There is no clear reason why forcing this root module import was ever necesary. Nothing that imports utils.ts depends on the side effects caused by "awsMixins", and the primary effect of adding the `sdk` getter onto the root module is only relevant if the end user loads that root module itself so they can access this property.

Also expands some existing test coverage to test this and use of `aws.sdk`, which is the related feature that could in principle be impacted by removing this forced side effect

Fixes #772.

* Remove aws.sdk property

The `aws.sdk` proeprty was introduced several years ago to offer a convenient way for callbacks using function serialization to get ahold of the AWS SDK which is available within the Lambda runtime.

However, the AWS SDK v2 that was exposed here is being deprecated, and has been emitted a deprecation warning for some time for anyone using this via Pulumi.

The AWS SDK v3 doesn't expose a monolitchic module we can expose here - providing instead many seperate SDKs for each service.

So we expect the best path is to drop this from the AWS provider in the upcoming major version release.

Users who were using it in <6.0.0 versions will need to move to using `@aws-sdk/client-s3` or similar libraries directly.
iwahbe pushed a commit that referenced this pull request Jul 18, 2023
* Avoid importing full root `@pulumi/aws` module (#2569)

Every folder inside the AWS Node.js SDK that has a mixin was importing "../utils", which imports "./awsMixins" which itself was forcing import of "." which then goes back and tries to force import of everything.  There is no clear reason why forcing this root module import was ever necesary. Nothing that imports utils.ts depends on the side effects caused by "awsMixins", and the primary effect of adding the `sdk` getter onto the root module is only relevant if the end user loads that root module itself so they can access this property.

Also expands some existing test coverage to test this and use of `aws.sdk`, which is the related feature that could in principle be impacted by removing this forced side effect

Fixes #772.

* Remove aws.sdk property

The `aws.sdk` proeprty was introduced several years ago to offer a convenient way for callbacks using function serialization to get ahold of the AWS SDK which is available within the Lambda runtime.

However, the AWS SDK v2 that was exposed here is being deprecated, and has been emitted a deprecation warning for some time for anyone using this via Pulumi.

The AWS SDK v3 doesn't expose a monolitchic module we can expose here - providing instead many seperate SDKs for each service.

So we expect the best path is to drop this from the AWS provider in the upcoming major version release.

Users who were using it in <6.0.0 versions will need to move to using `@aws-sdk/client-s3` or similar libraries directly.
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.

Directly importing a type leads to exception
3 participants