{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/firebase-functions/issues/357","repository_url":"https://api.github.com/repos/firebase/firebase-functions","labels_url":"https://api.github.com/repos/firebase/firebase-functions/issues/357/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-functions/issues/357/comments","events_url":"https://api.github.com/repos/firebase/firebase-functions/issues/357/events","html_url":"https://github.com/firebase/firebase-functions/issues/357","id":391375966,"node_id":"MDU6SXNzdWUzOTEzNzU5NjY=","number":357,"title":"Firestore trigger: `context.params` sometimes not populated","user":{"login":"joshdifabio","id":5609851,"node_id":"MDQ6VXNlcjU2MDk4NTE=","avatar_url":"https://avatars1.githubusercontent.com/u/5609851?v=4","gravatar_id":"","url":"https://api.github.com/users/joshdifabio","html_url":"https://github.com/joshdifabio","followers_url":"https://api.github.com/users/joshdifabio/followers","following_url":"https://api.github.com/users/joshdifabio/following{/other_user}","gists_url":"https://api.github.com/users/joshdifabio/gists{/gist_id}","starred_url":"https://api.github.com/users/joshdifabio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshdifabio/subscriptions","organizations_url":"https://api.github.com/users/joshdifabio/orgs","repos_url":"https://api.github.com/users/joshdifabio/repos","events_url":"https://api.github.com/users/joshdifabio/events{/privacy}","received_events_url":"https://api.github.com/users/joshdifabio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-15T12:57:03Z","updated_at":"2018-12-15T13:43:53Z","closed_at":null,"author_association":"NONE","body":"I have had a few Cloud Firestore triggers invoked today with empty `context.params`. This is an intermittent issue, and today is the first time I've seen this happen. I did not deploy any changes to my cloud functions prior to this issue starting.\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**firebase-functions:** 2.0.5\r\n\r\n**firebase-tools:** 6.1.1\r\n\r\n**firebase-admin:** 6.0.0\r\n\r\n### Test case\r\n\r\nI have verified the bug by logging `context.params` in one of my Firestore `onUpdate` triggers using `console.log`.\r\n\r\n```ts\r\nfunctions.firestore.document(this.firestoreRoot + '/ledgers/{ledgerId}/accounts/{accountId}/transactions/{transactionId}')\r\n            .onUpdate((snapshot, {params}) => console.log(params));\r\n```\r\n\r\nTo prove the issue, I edit the document `/contexts/connections/ledgers/553cb118-b68e-46b2-afd5-0ef508858264/accounts/2af276566a9391a81390164d30b46941/transactions/f82c1c5cfea011f8aedfcfe31e411560` in the Firebase console and observe the logs to record the actual shape of `context.params` during the trigger invocation.\r\n\r\n### Were you able to successfully deploy your functions?\r\n\r\nI was able to deploy my functions. There were no errors. These functions were deployed weeks ago and have been invoked correctly thousands of times during that period.\r\n\r\n### Expected behavior\r\n\r\n`context.params` should look like this (and most of the time it does):\r\n\r\n```js\r\n{ accountId: '2af276566a9391a81390164d30b46941',\r\n     ledgerId: '553cb118-b68e-46b2-afd5-0ef508858264',\r\n     transactionId: 'f82c1c5cfea011f8aedfcfe31e411560' }\r\n```\r\n\r\n### Actual behavior\r\n\r\nToday, `context.params` sometimes looks like this:\r\n\r\n```js\r\n{ ledgerId: undefined,\r\n     accountId: undefined,\r\n     transactionId: undefined }\r\n```\r\n\r\nAs you can see, the params are `undefined`, _not_ `'undefined'`, so I don't think these params are even valid (document ID's must be strings). Something is very wrong here."},"comment":{"url":"https://api.github.com/repos/firebase/firebase-functions/issues/comments/447569571","html_url":"https://github.com/firebase/firebase-functions/issues/357#issuecomment-447569571","issue_url":"https://api.github.com/repos/firebase/firebase-functions/issues/357","id":447569571,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzU2OTU3MQ==","user":{"login":"joshdifabio","id":5609851,"node_id":"MDQ6VXNlcjU2MDk4NTE=","avatar_url":"https://avatars1.githubusercontent.com/u/5609851?v=4","gravatar_id":"","url":"https://api.github.com/users/joshdifabio","html_url":"https://github.com/joshdifabio","followers_url":"https://api.github.com/users/joshdifabio/followers","following_url":"https://api.github.com/users/joshdifabio/following{/other_user}","gists_url":"https://api.github.com/users/joshdifabio/gists{/gist_id}","starred_url":"https://api.github.com/users/joshdifabio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshdifabio/subscriptions","organizations_url":"https://api.github.com/users/joshdifabio/orgs","repos_url":"https://api.github.com/users/joshdifabio/repos","events_url":"https://api.github.com/users/joshdifabio/events{/privacy}","received_events_url":"https://api.github.com/users/joshdifabio/received_events","type":"User","site_admin":false},"created_at":"2018-12-15T13:43:53Z","updated_at":"2018-12-15T13:43:53Z","author_association":"NONE","body":"Another repro (I am now also logging `snapshot.after.ref.path`):\r\n\r\n```js\r\npath: 'contexts/connections/ledgers/553cb118-b68e-46b2-afd5-0ef508858264/accounts/2af276566a9391a81390164d30b46941/transactions/1e7aece70d469caa21ac379e7c142f37',\r\n  params: \r\n   { ledgerId: undefined,\r\n     accountId: undefined,\r\n     transactionId: undefined },\r\n```"}}
{"actor":{"display_login":"joshdifabio"}}