{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/firebase-functions/issues/568","repository_url":"https://api.github.com/repos/firebase/firebase-functions","labels_url":"https://api.github.com/repos/firebase/firebase-functions/issues/568/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-functions/issues/568/comments","events_url":"https://api.github.com/repos/firebase/firebase-functions/issues/568/events","html_url":"https://github.com/firebase/firebase-functions/issues/568","id":507843013,"node_id":"MDU6SXNzdWU1MDc4NDMwMTM=","number":568,"title":"Firestore/triggers grpc-js No connection established errors","user":{"login":"clytras","id":6103077,"node_id":"MDQ6VXNlcjYxMDMwNzc=","avatar_url":"https://avatars1.githubusercontent.com/u/6103077?v=4","gravatar_id":"","url":"https://api.github.com/users/clytras","html_url":"https://github.com/clytras","followers_url":"https://api.github.com/users/clytras/followers","following_url":"https://api.github.com/users/clytras/following{/other_user}","gists_url":"https://api.github.com/users/clytras/gists{/gist_id}","starred_url":"https://api.github.com/users/clytras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clytras/subscriptions","organizations_url":"https://api.github.com/users/clytras/orgs","repos_url":"https://api.github.com/users/clytras/repos","events_url":"https://api.github.com/users/clytras/events{/privacy}","received_events_url":"https://api.github.com/users/clytras/received_events","type":"User","site_admin":false},"labels":[{"id":1175133029,"node_id":"MDU6TGFiZWwxMTc1MTMzMDI5","url":"https://api.github.com/repos/firebase/firebase-functions/labels/needs-triage","name":"needs-triage","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":30,"created_at":"2019-10-16T13:12:03Z","updated_at":"2019-10-21T19:16:12Z","closed_at":null,"author_association":"NONE","body":"<!-- DO NOT DELETE\r\nvalidate_template=true\r\ntemplate_path=.github/ISSUE_TEMPLATE/---report-a-bug.md\r\n-->\r\n\r\n### Related issues\r\n\r\n<!-- Are there any related firebase-functions issues that you found on this topic before deciding to open a new issue? Please link them here-->\r\n\r\nhttps://github.com/googleapis/nodejs-firestore/issues/768\r\n\r\nhttps://github.com/firebase/firebase-js-sdk/issues/1783\r\n\r\nhttps://github.com/grpc/grpc-node/issues/1027\r\n\r\n### Version info\r\n\r\n<!-- What versions of the following libraries are you using? Note that your issue may already\r\nbe fixed in the latest versions. -->\r\n\r\n**node:** 10.15.1\r\n\r\n<!-- Run node --version and print the output here-->\r\n\r\n**firebase-functions:** 3.3.0\r\n\r\n**firebase-tools:** 7.6.0\r\n\r\n<!-- Run firebase --version and print the output here-->\r\n\r\n**firebase-admin:** 8.6.0\r\n\r\n### Test case\r\n\r\n<!-- Provide a minimal, complete, and verifiable example (http://stackoverflow.com/help/mcve) -->\r\n\r\n```\r\nexports.addDriverLocation = functions.region(region).firestore\r\n  .document('drivers/{userId}/locations/{locationId}')\r\n  .onCreate((snap, context) => {\r\n    const { userId = -3 } = context.params;\r\n    const record = snap.data();\r\n    const { location = {}} = record;\r\n    const {\r\n      uuid,\r\n      coords: {\r\n        latitude,\r\n        longitude\r\n      } = {},\r\n      extras\r\n    } = location;\r\n\r\n    return snap.ref.set({\r\n      userId,\r\n      // server timestamp\r\n      sts: admin.firestore.Timestamp.fromDate(new Date()),\r\n      // client timestamp\r\n      cts: admin.firestore.Timestamp.fromDate(new Date(timestamp)),\r\n      latitude,\r\n      longitude,\r\n      extras\r\n    });\r\n```\r\n\r\n### Steps to reproduce\r\n\r\n<!-- Provide the steps needed to reproduce the issue given the above test case. -->\r\n\r\n1. Create a firestore trigger function\r\n\r\n### Expected behavior\r\n\r\n<!-- What is the expected behavior? -->\r\nEvery call should be get executed without gRPC related errors.\r\n\r\n### Actual behavior\r\n\r\nEvery now and then we get a *No connection established* error:\r\n\r\n```\r\nError: No connection established\r\n    at Http2CallStream.call.on (/srv/functions/node_modules/@grpc/grpc-js/build/src/client.js:96:45)\r\n    at Http2CallStream.emit (events.js:194:15)\r\n    at Http2CallStream.EventEmitter.emit (domain.js:459:23)\r\n    at process.nextTick (/srv/functions/node_modules/@grpc/grpc-js/build/src/call-stream.js:75:22)\r\n    at process._tickCallback (internal/process/next_tick.js:61:11)\r\n```\r\n\r\nIt encountered 8600 exact errors for the past week:\r\n\r\n![Cloud Functions erors view](https://user-images.githubusercontent.com/6103077/66921955-d12c1600-f02e-11e9-807d-e8840195c7b8.png)\r\n\r\nFor every other firestore operation, we used old `grpc` as described here https://github.com/googleapis/nodejs-firestore/issues/768#issuecomment-537311719:\r\n\r\n```\r\nconst Firestore = require('@google-cloud/firestore');\r\nconst grpc = require('grpc');\r\nconst firestore = new Firestore({ grpc });\r\n```\r\n\r\nbut we don't know how to set old grpc for `functions.region(region).firestore` to get rid of all these errors.\r\n\r\nWe 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.\r\n\r\n<!-- Please copy and paste any error logs from https://console.firebase.google.com/project/_/functions/logs.\r\n     If you're experiencing a deployment issue, please copy and paste the entirety of firebase-debug.log -->\r\n\r\n### Were you able to successfully deploy your functions?\r\n\r\n<!-- When you ran `firebase deploy`, did you see any error messages? -->\r\n\r\nNo errors during functions deploy."},"comment":{"url":"https://api.github.com/repos/firebase/firebase-functions/issues/comments/544664826","html_url":"https://github.com/firebase/firebase-functions/issues/568#issuecomment-544664826","issue_url":"https://api.github.com/repos/firebase/firebase-functions/issues/568","id":544664826,"node_id":"MDEyOklzc3VlQ29tbWVudDU0NDY2NDgyNg==","user":{"login":"colepanike","id":3092695,"node_id":"MDQ6VXNlcjMwOTI2OTU=","avatar_url":"https://avatars2.githubusercontent.com/u/3092695?v=4","gravatar_id":"","url":"https://api.github.com/users/colepanike","html_url":"https://github.com/colepanike","followers_url":"https://api.github.com/users/colepanike/followers","following_url":"https://api.github.com/users/colepanike/following{/other_user}","gists_url":"https://api.github.com/users/colepanike/gists{/gist_id}","starred_url":"https://api.github.com/users/colepanike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colepanike/subscriptions","organizations_url":"https://api.github.com/users/colepanike/orgs","repos_url":"https://api.github.com/users/colepanike/repos","events_url":"https://api.github.com/users/colepanike/events{/privacy}","received_events_url":"https://api.github.com/users/colepanike/received_events","type":"User","site_admin":false},"created_at":"2019-10-21T19:16:12Z","updated_at":"2019-10-21T19:16:12Z","author_association":"NONE","body":"Dealing with this same issue just trying to use firestore."}}
{"actor":{"display_login":"colepanike"}}