File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -270,7 +270,8 @@ export const RETRYABLE_ERR_FN_DEFAULT = function (err?: ApiError) {
270270 reason . includes ( 'eai_again' ) || // DNS lookup error
271271 reason === 'econnreset' ||
272272 reason === 'unexpected connection closure' ||
273- reason === 'epipe'
273+ reason === 'epipe' ||
274+ reason === 'socket connection timeout'
274275 ) ;
275276 } ;
276277
Original file line number Diff line number Diff line change @@ -323,6 +323,24 @@ describe('Storage', () => {
323323 assert . strictEqual ( calledWith . retryOptions . retryableErrorFn ( error ) , true ) ;
324324 } ) ;
325325
326+ it ( 'should retry a socket connection timeout' , ( ) => {
327+ const storage = new Storage ( {
328+ projectId : PROJECT_ID ,
329+ } ) ;
330+ const calledWith = storage . calledWith_ [ 0 ] ;
331+ const error = new ApiError ( 'Broken pipe' ) ;
332+ const innerError = {
333+ /**
334+ * @link https://nodejs.org/api/errors.html#err_socket_connection_timeout
335+ * @link https://github.com/nodejs/node/blob/798db3c92a9b9c9f991eed59ce91e9974c052bc9/lib/internal/errors.js#L1570-L1571
336+ */
337+ reason : 'Socket connection timeout' ,
338+ } ;
339+
340+ error . errors = [ innerError ] ;
341+ assert . strictEqual ( calledWith . retryOptions . retryableErrorFn ( error ) , true ) ;
342+ } ) ;
343+
326344 it ( 'should not retry a 999 error' , ( ) => {
327345 const storage = new Storage ( {
328346 projectId : PROJECT_ID ,
You can’t perform that action at this time.
0 commit comments