Skip to content

Commit 11821e1

Browse files
committed
refactor: re-add hack to only import node-http on non-web
1 parent 95aa6c0 commit 11821e1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/core/src/shared/awsClientBuilderV3.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import { partialClone } from './utilities/collectionUtils'
3636
import { selectFrom } from './utilities/tsUtils'
3737
import { once } from './utilities/functionUtils'
3838
import { isWeb } from './extensionGlobals'
39-
import { NodeHttpHandler } from '@smithy/node-http-handler'
4039

4140
export type AwsClientConstructor<C> = new (o: AwsClientOptions) => C
4241

@@ -94,9 +93,14 @@ export class AWSClientBuilderV3 {
9493

9594
private buildHttpClient() {
9695
const requestTimeout = 30000
96+
// HACK: avoid importing node-http-handler on web.
9797
return isWeb()
9898
? new FetchHttpHandler({ keepAlive: true, requestTimeout })
99-
: new NodeHttpHandler({ httpAgent: { keepAlive: true }, httpsAgent: { keepAlive: true }, requestTimeout })
99+
: new (require('@smithy/node-http-handler').NodeHttpHandler)({
100+
httpAgent: { keepAlive: true },
101+
httpsAgent: { keepAlive: true },
102+
requestTimeout,
103+
})
100104
}
101105

102106
private getHttpClient = once(this.buildHttpClient.bind(this))

0 commit comments

Comments
 (0)