Skip to content

Firestore/triggers grpc-js No connection established errors #568

Closed
@clytras

Description

@clytras

Related issues

googleapis/nodejs-firestore#768

firebase/firebase-js-sdk#1783

grpc/grpc-node#1027

Version info

node: 10.15.1

firebase-functions: 3.3.0

firebase-tools: 7.6.0

firebase-admin: 8.6.0

Test case

exports.addDriverLocation = functions.region(region).firestore
  .document('drivers/{userId}/locations/{locationId}')
  .onCreate((snap, context) => {
    const { userId = -3 } = context.params;
    const record = snap.data();
    const { location = {}} = record;
    const {
      uuid,
      coords: {
        latitude,
        longitude
      } = {},
      extras
    } = location;

    return snap.ref.set({
      userId,
      // server timestamp
      sts: admin.firestore.Timestamp.fromDate(new Date()),
      // client timestamp
      cts: admin.firestore.Timestamp.fromDate(new Date(timestamp)),
      latitude,
      longitude,
      extras
    });

Steps to reproduce

  1. Create a firestore trigger function

Expected behavior

Every call should be get executed without gRPC related errors.

Actual behavior

Every now and then we get a No connection established error:

Error: No connection established
    at Http2CallStream.call.on (/srv/functions/node_modules/@grpc/grpc-js/build/src/client.js:96:45)
    at Http2CallStream.emit (events.js:194:15)
    at Http2CallStream.EventEmitter.emit (domain.js:459:23)
    at process.nextTick (/srv/functions/node_modules/@grpc/grpc-js/build/src/call-stream.js:75:22)
    at process._tickCallback (internal/process/next_tick.js:61:11)

It encountered 8600 exact errors for the past week:

Cloud Functions erors view

For every other firestore operation, we used old grpc as described here googleapis/nodejs-firestore#768 (comment):

const Firestore = require('@google-cloud/firestore');
const grpc = require('grpc');
const firestore = new Firestore({ grpc });

but we don't know how to set old grpc for functions.region(region).firestore to get rid of all these errors.

We are not sure if here is the right place to post this issue or the https://github.com/googleapis/nodejs-firestore. If this is the case, the please close this issue and we'll go and report it on the nodejs-firestore repo.

Were you able to successfully deploy your functions?

No errors during functions deploy.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions