{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/firebase-functions/issues/300","repository_url":"https://api.github.com/repos/firebase/firebase-functions","labels_url":"https://api.github.com/repos/firebase/firebase-functions/issues/300/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-functions/issues/300/comments","events_url":"https://api.github.com/repos/firebase/firebase-functions/issues/300/events","html_url":"https://github.com/firebase/firebase-functions/issues/300","id":347622674,"node_id":"MDU6SXNzdWUzNDc2MjI2NzQ=","number":300,"title":"Include `context.auth` for Firestore triggers","user":{"login":"brianmhunt","id":135528,"node_id":"MDQ6VXNlcjEzNTUyOA==","avatar_url":"https://avatars1.githubusercontent.com/u/135528?v=4","gravatar_id":"","url":"https://api.github.com/users/brianmhunt","html_url":"https://github.com/brianmhunt","followers_url":"https://api.github.com/users/brianmhunt/followers","following_url":"https://api.github.com/users/brianmhunt/following{/other_user}","gists_url":"https://api.github.com/users/brianmhunt/gists{/gist_id}","starred_url":"https://api.github.com/users/brianmhunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianmhunt/subscriptions","organizations_url":"https://api.github.com/users/brianmhunt/orgs","repos_url":"https://api.github.com/users/brianmhunt/repos","events_url":"https://api.github.com/users/brianmhunt/events{/privacy}","received_events_url":"https://api.github.com/users/brianmhunt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-04T14:22:26Z","updated_at":"2018-10-10T12:42:34Z","closed_at":null,"author_association":"NONE","body":"### Version info\r\n\r\n**firebase-functions:** ^2.0.2\r\n**firebase-tools:** ^4.0.2\r\n**firebase-admin:** ^5.13.1\r\n\r\n### Test case\r\n\r\n```js\r\nfunctions.firestore\r\n    .document('test/model')\r\n    .onWrite((data, context) => {\r\n       expect(context.auth.uid).toEqual('the-user-id')\r\n    })\r\n```\r\n\r\n\r\n### Steps to reproduce\r\n\r\nHere's a test case at [brianmhunt/bug-reports](https://github.com/brianmhunt/bug-reports/tree/firestore-functions-auth) on the `firestore-functions-auth` branch.  Just clone, `yarn install` and `yarn test` (or `npm ^^`).\r\n\r\nNote that the test case is not testing production behaviour, but the `firebase-functions-test` behaviour, however I would expect the test and production behaviour to be fixed in tandem.\r\n\r\n### Expected behavior\r\n\r\nThe `EventContext` for a Firestore call should contain the user authentication information, as it does [with Callable and Realtime database](https://firebase.google.com/docs/reference/functions/functions.EventContext) calls, i.e. `context.auth` should be populated.\r\n\r\n### Actual behavior\r\n\r\nThe `context.auth` is undefined for firestore `onWrite` and related functions."},"comment":{"url":"https://api.github.com/repos/firebase/firebase-functions/issues/comments/428556585","html_url":"https://github.com/firebase/firebase-functions/issues/300#issuecomment-428556585","issue_url":"https://api.github.com/repos/firebase/firebase-functions/issues/300","id":428556585,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODU1NjU4NQ==","user":{"login":"brianmhunt","id":135528,"node_id":"MDQ6VXNlcjEzNTUyOA==","avatar_url":"https://avatars1.githubusercontent.com/u/135528?v=4","gravatar_id":"","url":"https://api.github.com/users/brianmhunt","html_url":"https://github.com/brianmhunt","followers_url":"https://api.github.com/users/brianmhunt/followers","following_url":"https://api.github.com/users/brianmhunt/following{/other_user}","gists_url":"https://api.github.com/users/brianmhunt/gists{/gist_id}","starred_url":"https://api.github.com/users/brianmhunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianmhunt/subscriptions","organizations_url":"https://api.github.com/users/brianmhunt/orgs","repos_url":"https://api.github.com/users/brianmhunt/repos","events_url":"https://api.github.com/users/brianmhunt/events{/privacy}","received_events_url":"https://api.github.com/users/brianmhunt/received_events","type":"User","site_admin":false},"created_at":"2018-10-10T12:42:34Z","updated_at":"2018-10-10T12:42:34Z","author_association":"NONE","body":"@ohtangza Note the comment in the second paragraph of the docs you linked:\r\n\r\n> This field is only populated for Realtime Database triggers and Callable functions."}}
{"actor":{"display_login":"brianmhunt"}}