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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .evergreen/run-mongodb-aws-ecs-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.

2 changes: 0 additions & 2 deletions .evergreen/setup-mongodb-aws-auth-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.


if [ $MONGODB_AWS_SDK = 'false' ]; then rm -rf ./node_modules/@aws-sdk/credential-providers; fi

# revert to show test output
Expand Down
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"peerDependencies": {
"@aws-sdk/credential-providers": "^3.632.0",
"@mongodb-js/zstd": "^1.1.0 || ^2.0.0",
"aws4": "^1.13.2",
"gcp-metadata": "^5.2.0",
"kerberos": "^2.0.1",
"mongodb-client-encryption": ">=6.0.0 <7",
Expand All @@ -45,6 +46,9 @@
"@mongodb-js/zstd": {
"optional": true
},
"aws4": {
"optional": true
},
"kerberos": {
"optional": true
},
Expand All @@ -68,6 +72,7 @@
"@microsoft/api-extractor": "^7.49.2",
"@microsoft/tsdoc-config": "^0.17.1",
"@mongodb-js/zstd": "^2.0.0",
"@types/aws4": "^1.11.6",
"@types/chai": "^4.3.17",
"@types/chai-subset": "^1.3.5",
"@types/express": "^4.17.21",
Expand All @@ -81,6 +86,7 @@
"@types/whatwg-url": "^11.0.5",
"@typescript-eslint/eslint-plugin": "8.4.0",
"@typescript-eslint/parser": "8.4.0",
"aws4": "^1.13.2",
"chai": "^4.4.1",
"chai-subset": "^1.6.0",
"chalk": "^4.1.2",
Expand Down
4 changes: 2 additions & 2 deletions src/cmap/auth/mongodb_aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ export class MongoDBAWS extends AuthProvider {
);

const payload: AWSSaslContinuePayload = {
a: options.headers.Authorization,
d: options.headers['X-Amz-Date']
a: `${options.headers?.Authorization ?? ''}`,
d: `${options.headers?.['X-Amz-Date'] ?? ''}`
Comment on lines +141 to +142
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.

};

if (sessionToken) {
Expand Down
4 changes: 2 additions & 2 deletions src/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ interface AWS4 {
};
}

export const aws4: AWS4 | { kModuleError: MongoMissingDependencyError } = loadAws4();
export const aws4 = loadAws4();

function loadAws4() {
let aws4: AWS4 | { kModuleError: MongoMissingDependencyError };
let aws4: typeof import('aws4') | { kModuleError: MongoMissingDependencyError };
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
aws4 = require('aws4');
Expand Down