Skip to content

Commit 6d0866b

Browse files
committed
undo aws4 change
1 parent 31a4901 commit 6d0866b

File tree

7 files changed

+13
-20
lines changed

7 files changed

+13
-20
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ cd $DRIVERS_TOOLS/.evergreen/auth_aws
2323

2424
cd $BEFORE
2525

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

2830
# revert to show test output

package-lock.json

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

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
"@types/whatwg-url": "^11.0.5",
8282
"@typescript-eslint/eslint-plugin": "8.4.0",
8383
"@typescript-eslint/parser": "8.4.0",
84-
"aws4": "^1.13.2",
8584
"chai": "^4.4.1",
8685
"chai-subset": "^1.6.0",
8786
"chalk": "^4.1.2",

src/cmap/auth/mongodb_aws.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import type { Binary, BSONSerializeOptions } from '../../bson';
22
import * as BSON from '../../bson';
3-
import { type AWS4, loadAws4 } from '../../deps';
3+
import { aws4 } from '../../deps';
44
import {
55
MongoCompatibilityError,
66
MongoMissingCredentialsError,
7-
type MongoMissingDependencyError,
87
MongoRuntimeError
98
} from '../../error';
109
import { ByteUtils, maxWireVersion, ns, randomBytes } from '../../utils';
@@ -33,8 +32,6 @@ interface AWSSaslContinuePayload {
3332
t?: string;
3433
}
3534

36-
let aws4: AWS4 | { kModuleError: MongoMissingDependencyError };
37-
3835
export class MongoDBAWS extends AuthProvider {
3936
private credentialFetcher: AWSTemporaryCredentialProvider;
4037
constructor() {
@@ -51,7 +48,6 @@ export class MongoDBAWS extends AuthProvider {
5148
throw new MongoMissingCredentialsError('AuthContext must provide credentials.');
5249
}
5350

54-
aws4 ??= loadAws4();
5551
if ('kModuleError' in aws4) {
5652
throw aws4['kModuleError'];
5753
}

src/deps.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ export function getSocks(): SocksLib | { kModuleError: MongoMissingDependencyErr
203203
}
204204
}
205205

206-
/** @internal */
207-
export interface AWS4 {
206+
interface AWS4 {
208207
/**
209208
* Created these inline types to better assert future usage of this API
210209
* @param options - options for request
@@ -245,7 +244,9 @@ export interface AWS4 {
245244
};
246245
}
247246

248-
export function loadAws4() {
247+
export const aws4: AWS4 | { kModuleError: MongoMissingDependencyError } = loadAws4();
248+
249+
function loadAws4() {
249250
let aws4: AWS4 | { kModuleError: MongoMissingDependencyError };
250251
try {
251252
// eslint-disable-next-line @typescript-eslint/no-require-imports

test/unit/assorted/optional_require.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ describe('optionalRequire', function () {
6262
}
6363
const mdbAWS = new MongoDBAWS();
6464

65-
const error = await mdbAWS.auth(
66-
new AuthContext({ hello: { maxWireVersion: 9 } }, true, null)
67-
);
65+
const error = await mdbAWS
66+
.auth(new AuthContext({ hello: { maxWireVersion: 9 } }, true, null))
67+
.catch(error => error);
6868

6969
expect(error).to.be.instanceOf(MongoMissingDependencyError);
7070
});

0 commit comments

Comments
 (0)