“Socket Hang Up” / ECONNRESET Error while uploadin

2019-08-20 04:26发布

问题:

We're using Google Cloud Storage to store pictures uploaded by our users. For some reason, it stopped to work today.

var googleapis = require('googleapis');
var GoogleAuth = require('google-auth-library');

var googleAuth = new GoogleAuth();
var authClient = new googleAuth.JWTClient(
    accountEmail, keyFile, null,
    'https://www.googleapis.com/auth/devstorage.read_write'
);

authClient.authorize(function (err) {
    // Error here: { [Error: socket hang up] code: 'ECONNRESET' }
});

So it seems like I can not establish a connection to the Google Cloud Storage.

回答1:

I was using Node v0.12 and required the longjohn package. When I exclude the longjohn package (which is only for longer stack traces), it works. I don't know why, but maybe it helps someone.