-
Notifications
You must be signed in to change notification settings - Fork 123
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
adds a new export from the package for aws-sdk v3 #758
Conversation
Signed-off-by: Tushar Sharma <[email protected]>
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.
Good stuff. Document new functionality/changes in README, USERS_GUIDE, update samples. Add tests.
It's a good idea, but I would explore this in a future/separate PR. |
Signed-off-by: Tushar Sharma <[email protected]>
@dblock updated the PR with the requested changes |
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 looks great to me!
Let's get another pair of eyes, maybe @nhtruong and merge?
@tusharf5 fix CI pls, there's some license headers missing, and a complaint about a new license, 0BSD. It's just a BSD variant |
Signed-off-by: Tushar Sharma <[email protected]>
Signed-off-by: Tushar Sharma <[email protected]>
The license workflow needs to have 0BSD added to it, https://github.com/opensearch-project/opensearch-js/actions/runs/8739773216/job/23986128639?pr=758. |
Signed-off-by: Tushar Sharma <[email protected]>
@dblock fixed |
checking the test error |
Signed-off-by: Tushar Sharma <[email protected]>
Signed-off-by: Tushar Sharma <[email protected]>
1 existing test was failing since aws-sdk and v3 ask were not installed so the error thrown was different and now they are part of dev dependency so the error has changed. I've updated the test. hopefully no more test failures. @dblock Edit - For some reason I can't run tests locally, I get "ERR_REQUIRE_ESM" errors otherwise I would have caught & fixed these errors locally. |
Signed-off-by: Tushar Sharma <[email protected]>
Signed-off-by: Tushar Sharma <[email protected]>
Signed-off-by: Tushar Sharma <[email protected]>
Signed-off-by: Tushar Sharma <[email protected]>
Signed-off-by: Tushar Sharma <[email protected]>
Signed-off-by: Tushar Sharma <[email protected]>
Signed-off-by: Tushar Sharma <[email protected]>
Had to remove the peerDependency change since npm automatically installs peerDepenencies (yarn does not) and that changes the import result which fails the test. It should be working now. |
server.stop(); | ||
}); | ||
}); | ||
}); |
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.
Are these tests only testing if they throw the correct errors, and not for the code paths where no errors are thrown? I think that's why Codecov is not happy.
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 would require mocking the import as the dependencies are not installed. While tap supports mocking imports, the project does not use the latest tap version which has breaking changes.
Doesn't seem like there is any other way to test dependency missing/present scenarios without mocking.
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.
We should solve this with integration tests IMO, which is a separate affair.
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.
I'm thinking of setting up different package.json
for each test case like you have in test/bundlers/esbuild-test/package.json
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.
It's a good idea. Do we want to hold this PR until then? Open an issue and do it later?
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.
Let's do it in a different PR so we can get this merged. I'll make an issue.
Description
Based on the conversation in this issue #757 , this PR adds a new way to import the AwsSigv4Signer as shown below.
By using a new import path, the sdk remains backwards compatible while also adding a way for clients to avoid getting the entire aws-sdk included in the final bundle which results in an additional 22MB.
I tested the code and it does reduce the bundle size with the new import path
The bundle size is still not good though because '@aws-sdk/credential-provider-node' dynamically imports all types of credential providers ini, ec2, environment, node, process, http etc which is about 1MB in size.
Would it make sense to have the client provide the provider based on the environment instead of relying on the default provider chain? This would be a breaking change but it would delegate the credential responsibility on the client eliminating the dependency on aws-sdk & @aws-sdk/credential-provider-node?
https://github.com/opensearch-project/opensearch-js/blob/main/lib/aws/AwsSigv4Signer.js#L74
We will have to throw an error on this (making it required) line so the client always provides a
getCredential
function and we can remove the dependency on a default provider (both v2 and v3) from our end.The doc examples already use the
getCredential
function so I am guessing most of the clients would already be providing this function and not relying on the defaultgetCredential
.https://opensearch.org/docs/latest/clients/javascript/index/#authenticating-with-amazon-opensearch-service-aws-signature-version-4
Issues Resolved
Closes #757
Check List
yarn run lint
doesn't show any errorsBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.