-
Notifications
You must be signed in to change notification settings - Fork 151
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
Conversation
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.
Does the PR have any schema changes?Looking good! No breaking changes found. |
1 similar comment
Does the PR have any schema changes?Looking good! No breaking changes found. |
There was a problem hiding this 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.
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. |
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.
* 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.
* 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.
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 effectFixes #772.