Skip to content

Commit 42548d0

Browse files
authored
logging: supporess AWS SDK v2 warning #4445
Problem: AWS JS SDK v2 shows a very noisy warning. This warning appears in local debugging, in the CI logs, etc. NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023. Please migrate your code to use AWS SDK for JavaScript (v3). For more information, check the migration guide at https://a.co/7PzMCcy (Use `Code Helper (Plugin) --trace-warnings ...` to show where the warning was created) Solution: Suppress the warning (see aws/aws-sdk-js#4354). Updating to SDK v3 is in our backlog, so we don't need the warning. Fix #4371
1 parent c497aff commit 42548d0

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

packages/toolkit/src/extensionShared.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ import { showQuickStartWebview } from './shared/extensionStartup'
4242
import { ExtContext } from './shared/extensions'
4343
import { getSamCliContext } from './shared/sam/cli/samCliContext'
4444
import { UriHandler } from './shared/vscode/uriHandler'
45+
import { disableAwsSdkWarning } from './shared/awsClientBuilder'
46+
47+
disableAwsSdkWarning()
4548

4649
let localize: nls.LocalizeFunc
4750

packages/toolkit/src/shared/awsClientBuilder.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import { DevSettings } from './settings'
1111
import { getUserAgent } from './telemetry/util'
1212
import { telemetry } from './telemetry/telemetry'
1313

14+
/** Suppresses a very noisy warning printed by AWS SDK v2, which clutters local debugging output, CI logs, etc. */
15+
export function disableAwsSdkWarning() {
16+
// See https://github.com/aws/aws-sdk-js/issues/4354
17+
require('aws-sdk/lib/maintenance_mode_message').suppress = true
18+
}
19+
1420
// These are not on the public API but are very useful for logging purposes.
1521
// Tests guard against the possibility that these values change unexpectedly.
1622
// Since the field names are not prepended with `_` to signify visibility, the

packages/toolkit/src/test/globalSetup.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import * as testUtil from './testUtil'
2525
import { getTestWindow, resetTestWindow } from './shared/vscode/window'
2626
import { mapTestErrors, normalizeError, setRunnableTimeout } from './setupUtil'
2727
import { TelemetryDebounceInfo } from '../shared/vscode/commands2'
28+
import { disableAwsSdkWarning } from '../shared/awsClientBuilder'
29+
30+
disableAwsSdkWarning()
2831

2932
const testReportDir = join(__dirname, '../../../../../.test-reports') // Root project, not subproject
3033
const testLogOutput = join(testReportDir, 'testLog.log')

0 commit comments

Comments
 (0)