Q:

Retry total timeout exceeded before any response was received in GCP PubSub

I am trying to push to PubSub Topic in node js using @google-cloud/pubsub module 
Here is Javascript code 
const { pubsub } = require('@google-cloud/pubsub');

class MyPubSub {

constructor(container) {

    this.publisherUser = pubsub.topic(
        this.config.pubSubToBigQueryTopicName, {
            batching: {
                "maxMessages": 1
            }
        });
}

publishToPubSub(data) {
    let MAX_RETRIES = 3;
    return new Promise(async (resolve, reject) => {
        if (!data) {
            return reject(`Invalid param ${data}`);
        }
        const dataBuffer = Buffer.from(JSON.stringify(data));
        let err, id, cx = 0;
        do {
            [err, id] = await this.utility.invoker(this.publisherUser.publish(dataBuffer));
            cx++;
        } while (err && cx <= MAX_RETRIES);
        if (err) {
            return reject(err);
        }
        return resolve(id);
    });
 }
}

module.exports = MyPubSub;

but getting this error 
 error: {
    "stack":"Error: Retry total timeout exceeded before any response was received\n    
            at repeat (/my-service/node_modules/@google-cloud/pubsub/node_modules/google-gax/build/src/normalCalls/retries.js: 80: 31)\n  
        at Timeout.setTimeout 
        [as _onTimeout] (/my-service/node_modules/@google-cloud/pubsub/node_modules/google-gax/build/src/normalCalls/retries.js: 113: 25)\n    
        at ontimeout (timers.js: 498: 11)\n    
        at tryOnTimeout (timers.js: 323: 5)\n    
        at Timer.listOnTimeout (timers.js: 290: 5)",
      "message":"Retry total timeout exceeded before any response was received",
      "code":4
   } 

A:

I solved this problem by adding this "google-gax": "1.6.2" in package.json
@grpc/grpc-js@0.6.x has memory leak issues. grpc was required by google-gax which in turn was required by pubsub, cloud-task, and other google modules.
Here are some related issues here and here

