I have a Cloud function(node 10) that sends metrics using (@google-cloud/monitoring) MetricServiceClient.
I send 25 metrics using async-await syntax once a day (there is a similar task in another project at the same time).
const request = {
name: client.projectPath(projectId),
timeSeries: [timeSeriesData],
};
const options = {
timeout: 120000
};
try {
await client.createTimeSeries(request, options);
return Promise.resolve();
} catch (error) {
console.error(error);
throw error;
But from time to time I get an error on the environment(but can't reproduce it locally)
{ Error: 14 UNAVAILABLE: Deadline expired before operation could complete.
at Object.callErrorFromStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client.js:179:52)
at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
at process.nextTick (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78)
at process._tickCallback (internal/process/next_tick.js:61:11)
code: 14,
details: 'Deadline expired before operation could complete.',
metadata:
Metadata {internalRepr: Map { 'grpc-server-stats-bin' => [Array] }, options: {} } }
I checked different values for the timeout option but it seems that it isn't connected:
Error: 4 DEADLINE_EXCEEDED: Deadline exceeded that I tracked down by source code.I assume error details probably go from server-side @grpc/grpc-js/src/call-stream.ts line 592.
if (this.internalError.code === 'ECONNRESET') {
code = Status.UNAVAILABLE;
details = this.internalError.message;
Does anyone know where it might come from?