Skip to content

fix(NODE-6743)!: add back missing opt deps aws4 #4408

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

Closed

Conversation

mr-pinzhang
Copy link

@mr-pinzhang mr-pinzhang commented Feb 9, 2025

Description

https://jira.mongodb.org/browse/NODE-6743

What is changing?

the original PR is #2606, but seems like opt dep aws4 is getting lost since v3. starting from v4, there is no stricted opt dep under package.json. this PR is to add it back.

this issue affects all mongodb versions after v4, which might need to be patched to: v6.13.0, v5.9.2, v4.17.2

Is there new documentation needed for these changes?

n/a

What is the motivation for this change?

make developers life easier, since people might don't know what's happening until they see the error message on production env when using mongo aws.

[Error] Optional module `aws4` not found. Please install it to enable AWS authentication

Release Highlight

Fill in title or leave empty for no highlight

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@mr-pinzhang mr-pinzhang requested a review from a team as a code owner February 9, 2025 06:56
@mr-pinzhang mr-pinzhang changed the title fix: add back missing opt deps aws4 fix(NODE-6743): add back missing opt deps aws4 Feb 9, 2025
@mr-pinzhang mr-pinzhang changed the title fix(NODE-6743): add back missing opt deps aws4 fix(NODE-6743)!: add back missing opt deps aws4 Feb 9, 2025
@mr-pinzhang mr-pinzhang force-pushed the fix/missing-opt-dep-aws4 branch from 2eb49a4 to 4acc93a Compare February 9, 2025 07:19
@@ -13,6 +13,3 @@ source ./.evergreen/prepare-shell.sh # should not run git clone

# load node.js
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh

# run the tests
npm install aws4
Copy link
Author

Choose a reason for hiding this comment

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

not sure whether it's ok to remove this command.

@@ -23,8 +23,6 @@ cd $DRIVERS_TOOLS/.evergreen/auth_aws

cd $BEFORE

npm install --no-save aws4
Copy link
Author

Choose a reason for hiding this comment

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

this one too, seems like no longer needed.

Comment on lines +141 to +142
a: `${options.headers?.Authorization ?? ''}`,
d: `${options.headers?.['X-Amz-Date'] ?? ''}`
Copy link
Author

Choose a reason for hiding this comment

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

after using the typings from @types/aws4, options.headers becomes optional. converting those values to hard-coded string type.

@dariakp dariakp added tracked Ticket filed in MongoDB's Jira system External Submission PR submitted from outside the team labels Feb 10, 2025
@nbbeeken
Copy link
Contributor

Hi @mr-pinzhang, we would prefer to remove our dependence on this package as the logic contained within sign is rather small and should be something the driver owns as part of its authentication workflow given the inclusion in drivers specification. For the time being we do have documentation calling out the need for this package here: https://www.mongodb.com/docs/drivers/node/current/fundamentals/authentication/mechanisms/#mongodb-aws

We have https://jira.mongodb.org/browse/NODE-5393 to track the removal if you're interested in contributing; otherwise, we intend to work on it soon. Thanks for reaching out and taking the time to lend a hand here, we appreciate it!

@nbbeeken nbbeeken closed this Feb 10, 2025
@mr-pinzhang
Copy link
Author

Hi @mr-pinzhang, we would prefer to remove our dependence on this package as the logic contained within sign is rather small and should be something the driver owns as part of its authentication workflow given the inclusion in drivers specification. For the time being we do have documentation calling out the need for this package here: https://www.mongodb.com/docs/drivers/node/current/fundamentals/authentication/mechanisms/#mongodb-aws

We have https://jira.mongodb.org/browse/NODE-5393 to track the removal if you're interested in contributing; otherwise, we intend to work on it soon. Thanks for reaching out and taking the time to lend a hand here, we appreciate it!

Thanks for the heads up! Yeah, I agree we are going to move aws credentials to the driver's side. But my concern is that when someone is installing npm MongoDB, missing dep aws4 might be neglected if the user doesn't read the doc carefully (it happens to me 🫢). So one question: do we have some expected timeline for NODE-5393? if it's going to take a long time, fixing up package.json optional deps feels like a good idea to me for now. Just my 2 cents.

Anyway, my concern might make no sense. Let me know if you guys need any help, thanks!

@mr-pinzhang mr-pinzhang deleted the fix/missing-opt-dep-aws4 branch February 11, 2025 13:42
@nbbeeken
Copy link
Contributor

Your concern totally makes sense and it is a point of friction for us to address. We intend to get to it in a few months, which sounds long but scaled against this being an untracked peer dependency since at least 3.6.0 feels pretty soon. Introducing the real peer dep tracking comes with a degree of complexity we will just end up removing soon.

It isn't a great experience and we're sorry you hit this snag, it'll be better soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Submission PR submitted from outside the team tracked Ticket filed in MongoDB's Jira system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants