How to fix NodeJS Firebase AdminSDK GoogleError? - node.js

NodeJS Firebase AdminSDK GoogleError: Total timeout of API google.firestore.v1.Firestore exceeded 600000 milliseconds before any response was received
I am running a Node script to commit batches to the firestore. After 5-10 minutes of running the script locally, this error is returned:
GoogleError: Total timeout of API google.firestore.v1.Firestore exceeded 600000 milliseconds before any response was received.
at repeat (E:\Personal\NodeJs\Scraper\node_modules\google-gax\build\src\normalCalls\retries.js:66:31)
at Timeout._onTimeout (E:\Personal\NodeJs\Scraper\node_modules\google-gax\build\src\normalCalls\retries.js:101:25)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
Caused by: Error
at WriteBatch.commit (E:\Personal\NodeJs\Scraper\node_modules\#google-cloud\firestore\build\src\write-batch.js:417:23)
at upload (E:\Personal\NodeJs\Scraper\lib\index.js:127:23) {
code: 4
}
It is returned randomly whilst running the script so it is not an issue from the code.

Related

Call retries were exceeded error while archiving react-native application in x code

I'm trying to archive my react native application on xcode but I keep getting the following error
error node_modules/typescript/lib/typescript.js: Call retries were exceeded.
Error: Call retries were exceeded
at ChildProcessWorker.initialize (/Users/me/Desktop/app/reactnative_mobile/node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)
at ChildProcessWorker._onExit (/Users/me/Desktop/app/reactnative_mobile/node_modules/jest-worker/build/workers/ChildProcessWorker.js:274:12)
at ChildProcess.emit (node:events:513:28)
I've been trying to debug this for the past few days so any help would be greatly appreciated.
I've tried to remove jest-worker from node modules (as i'm not using it). I've also tried increasing the available memory for Node.js.

Getting Timeout errors when load increases in ioredis

We're using a NodeJS-based app using express for routing http requests. Before routing the requests we have a middleware to perform some validation using Redis, wherein we use ioredis.
When the load is moderate it works fine. But when there is an increase in load, ioredis started throwing timeout errors.
Error: Command timed out at Timeout._onTimeout (/proj/node_modules/ioredis/built/command.js:261:33) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7)
[stack]: 'Error: Command timed out\n' + ' at Timeout._onTimeout (/proj/node_modules/ioredis/built/command.js:261:33)\n' at listOnTimeout (internal/timers.js:554:17)\n' + ' at processTimers (internal/timers.js:497:7)',
[message]: 'Command timed out'
Initially, we had the command timeout set as 2 seconds. It started throwing the error frequently. Post that we now changed it to 5 seconds. It was better than before, but still, we face the timeout issue when the load increases.
We didn't find any redis slowlog too. We're using a Kubernetes setup within which we use redis sentinels ( 1 master 2 slaves ) to connect to from the app.
Any help on this query would be helpful

Websocket NodeJS Crashing

Hey there im getting this error which is crashing my program after 12h or 24h and i have to restart it is there anyway to fix this?
ERROR :
/root/Chat/node_modules/ws/lib/websocket.js:334
throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
^
Error: WebSocket is not open: readyState 0 (CONNECTING)
at WebSocket.send (/root/Chat/node_modules/ws/lib/websocket.js:334:13)
at Timeout._onTimeout (/root/Chat/index.js:51:14)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
Code : https://hastebin.com/fayasobeha.js
Websockets are not a common TCP servers, They are more of 2 way connection between the Client and the Server. If you following any architecture(Micro/Mono) Make sure you check is there any other system thread going on at peak hours which is causing the crash.
It's always better if you can wrap your service in Container and run it as a separate process there.

aws-serverless-express connection error - EPIPE

We have a NodeJS 10.16.3 Express API. We've recently switched from AWS Elastic Beanstalk/EC2 to Lambda / Serverless. Our DB is Postgres (PostgreSQL) 12.2.
It seemed all of a sudden I started getting this error on my local server when making requests from the client:
offline: ANY /dev/inventory/inventory (λ: app)
ERROR: aws-serverless-express connection error
{ Error: write EPIPE
at WriteWrap.afterWrite (net.js:788:14) errno: 'EPIPE', code: 'EPIPE', syscall: 'write' }
offline: (λ: app) RequestId: ckazracm0001emds69068drtu Duration: 2.58 ms Billed Duration: 100 ms
I can't seem to find much on this issue and I'm hoping someone can help.
Notes:
My local postgres is running
My .env.json file is correct
Found the error. Hopefully this will be helpful for others.
The error was due to exceeding the max cookie size of 4096 bytes in the application request headers. We solved it by stripping out erroneous cookies that were passed through some 3rd party services we were using, which has long encoded strings for cookie values.

Node.js 0.4.10. http get( ) request " ETIMEDOUT Connection timed out " frequently

Recently, I sank into the issue on "ETIMEDOUT Connection timed out".
My application just use the get() method to download files and data from the remote server.
during the downloading(I mean I have downloaded some files but not completely), I just get the "ETIMEDOUT Connection timed out". It's a bug of node.js? I use node.js 0.4.10. Because of the ETIMEDOUT, I cannot download files completely.
http = require('http');
client_req = http.get(...)//
//...
client_req.on('error', callback(err){...})/*When ETIMEDOUT, I get the error
message: ETIMEDOUT Connection timed out here.*/
This is not a Node.js bug, most probably the url cannot be reached anymore, that's why you get a timeout. As #DeaDEnD suggested, do a curl to see if you get a timeout also with cURL.

Resources