File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ - Disable 'keep-alive' in ` google-auth-library ` calls to avoid ` Premature close ` errors on some Node versions (#10716 ).
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ function proxyURIFromEnv(): string | undefined {
168168// https://github.com/node-fetch/node-fetch/issues/1767.
169169const httpAgentNoKeepAlive = new http . Agent ( { keepAlive : false } ) ;
170170const httpsAgentNoKeepAlive = new https . Agent ( { keepAlive : false } ) ;
171- function noKeepAliveAgent ( parsedURL : URL ) : http . Agent | https . Agent {
171+ export function noKeepAliveAgent ( parsedURL : URL ) : http . Agent | https . Agent {
172172 return parsedURL . protocol === "https:" ? httpsAgentNoKeepAlive : httpAgentNoKeepAlive ;
173173}
174174
Original file line number Diff line number Diff line change @@ -28,7 +28,18 @@ function getAuthClient(config: GoogleAuthOptions): GoogleAuth {
2828 return authClient ;
2929 }
3030
31- authClient = new GoogleAuth ( config ) ;
31+ const authConfig : GoogleAuthOptions = {
32+ ...config ,
33+ clientOptions : {
34+ ...config . clientOptions ,
35+ transporterOptions : {
36+ ...config . clientOptions ?. transporterOptions ,
37+ agent : apiv2 . noKeepAliveAgent ,
38+ } ,
39+ } ,
40+ } ;
41+
42+ authClient = new GoogleAuth ( authConfig ) ;
3243 return authClient ;
3344}
3445
You can’t perform that action at this time.
0 commit comments