Closed Jared00m closed 11 months ago
@Jared00m which version of Node are you running?
@danielbankhead , thanks for asking. I've tried it on Node 18, 16, 15, 14, and 12.
On node 15 I get a useful error that says:
data: {
error: {
code: 403,
message: 'Forbidden',
errors: [
{
message: 'Forbidden',
domain: 'global',
reason: 'forbidden'
}
]
}
},
On Node 18 I get this error:
config: {
method: 'POST',
url: 'https://www.googleapis.com/oauth2/v4/token',
data: {
grant_type: '<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.',
assertion: '<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.'
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'google-api-nodejs-client/9.2.0',
'x-goog-api-client': 'gl-node/18.3.0',
Accept: 'application/json'
},
responseType: 'json',
paramsSerializer: [Function: paramsSerializer],
body: '<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.',
validateStatus: [Function: validateStatus],
errorRedactor: [Function: defaultErrorRedactor]
},
response: undefined,
error: FetchError: Invalid response body while trying to fetch https://www.googleapis.com/oauth2/v4/token: read ECONNRESET
at Gunzip.<anonymous> (/Users/jared/Coding/language-app-test/language-app/functions/node_modules/node-fetch/lib/index.js:400:12)
at Gunzip.emit (node:events:539:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'ECONNRESET',
code: 'ECONNRESET'
},
code: 'ECONNRESET'
}
Investigating. Potentially related items:
After discussing with the team, this is best handled by setting up automatic retries in this library.
I'll prioritize this work and it can be tracked here:
This PR should provide some relief for the immediate issue:
I have been working on a Flutter project that uses Firebase Functions. In the past, I was able to create a Firebase Function that retrieves a JWT access token with no problem. However, recently, I get the following error every time:
{"severity":"ERROR","message":"Unhandled error GaxiosError: Invalid response body while trying to fetch https://www.googleapis.com/oauth2/v4/token: read ECONNRESET\n
Here is my code:
Any help would be greatly appreciated. I'm not a professional coder and I'm new to Firebase and Flutter.