Skip to content

Commit 4acc93a

Browse files
committed
fix: add back missing opt deps aws4
1 parent a79a13d commit 4acc93a

File tree

6 files changed

+33
-9
lines changed

6 files changed

+33
-9
lines changed

.evergreen/run-mongodb-aws-ecs-test.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,3 @@ source ./.evergreen/prepare-shell.sh # should not run git clone
1313

1414
# load node.js
1515
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh
16-
17-
# run the tests
18-
npm install aws4

.evergreen/setup-mongodb-aws-auth-tests.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ cd $DRIVERS_TOOLS/.evergreen/auth_aws
2323

2424
cd $BEFORE
2525

26-
npm install --no-save aws4
27-
2826
if [ $MONGODB_AWS_SDK = 'false' ]; then rm -rf ./node_modules/@aws-sdk/credential-providers; fi
2927

3028
# revert to show test output

package-lock.json

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"peerDependencies": {
3333
"@aws-sdk/credential-providers": "^3.632.0",
3434
"@mongodb-js/zstd": "^1.1.0 || ^2.0.0",
35+
"aws4": "^1.13.2",
3536
"gcp-metadata": "^5.2.0",
3637
"kerberos": "^2.0.1",
3738
"mongodb-client-encryption": ">=6.0.0 <7",
@@ -45,6 +46,9 @@
4546
"@mongodb-js/zstd": {
4647
"optional": true
4748
},
49+
"aws4": {
50+
"optional": true
51+
},
4852
"kerberos": {
4953
"optional": true
5054
},
@@ -68,6 +72,7 @@
6872
"@microsoft/api-extractor": "^7.49.2",
6973
"@microsoft/tsdoc-config": "^0.17.1",
7074
"@mongodb-js/zstd": "^2.0.0",
75+
"@types/aws4": "^1.11.6",
7176
"@types/chai": "^4.3.17",
7277
"@types/chai-subset": "^1.3.5",
7378
"@types/express": "^4.17.21",
@@ -81,6 +86,7 @@
8186
"@types/whatwg-url": "^11.0.5",
8287
"@typescript-eslint/eslint-plugin": "8.4.0",
8388
"@typescript-eslint/parser": "8.4.0",
89+
"aws4": "^1.13.2",
8490
"chai": "^4.4.1",
8591
"chai-subset": "^1.6.0",
8692
"chalk": "^4.1.2",

src/cmap/auth/mongodb_aws.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ export class MongoDBAWS extends AuthProvider {
138138
);
139139

140140
const payload: AWSSaslContinuePayload = {
141-
a: options.headers.Authorization,
142-
d: options.headers['X-Amz-Date']
141+
a: `${options.headers?.Authorization ?? ''}`,
142+
d: `${options.headers?.['X-Amz-Date'] ?? ''}`
143143
};
144144

145145
if (sessionToken) {

src/deps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ interface AWS4 {
244244
};
245245
}
246246

247-
export const aws4: AWS4 | { kModuleError: MongoMissingDependencyError } = loadAws4();
247+
export const aws4 = loadAws4();
248248

249249
function loadAws4() {
250-
let aws4: AWS4 | { kModuleError: MongoMissingDependencyError };
250+
let aws4: typeof import('aws4') | { kModuleError: MongoMissingDependencyError };
251251
try {
252252
// eslint-disable-next-line @typescript-eslint/no-require-imports
253253
aws4 = require('aws4');

0 commit comments

Comments
 (0)