{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/40","repository_url":"https://api.github.com/repos/firebase/firebase-js-sdk","labels_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/40/comments","events_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/40/events","html_url":"https://github.com/firebase/firebase-js-sdk/issues/40","id":234169507,"number":40,"title":"Storage: TypeError thrown when UploadTask#on observer is missing some methods","user":{"login":"jsayol","id":2029586,"avatar_url":"https://avatars2.githubusercontent.com/u/2029586?v=3","gravatar_id":"","url":"https://api.github.com/users/jsayol","html_url":"https://github.com/jsayol","followers_url":"https://api.github.com/users/jsayol/followers","following_url":"https://api.github.com/users/jsayol/following{/other_user}","gists_url":"https://api.github.com/users/jsayol/gists{/gist_id}","starred_url":"https://api.github.com/users/jsayol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsayol/subscriptions","organizations_url":"https://api.github.com/users/jsayol/orgs","repos_url":"https://api.github.com/users/jsayol/repos","events_url":"https://api.github.com/users/jsayol/events{/privacy}","received_events_url":"https://api.github.com/users/jsayol/received_events","type":"User","site_admin":false},"labels":[{"id":606540090,"url":"https://api.github.com/repos/firebase/firebase-js-sdk/labels/needs-triage","name":"needs-triage","color":"b60205","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-07T10:53:24Z","updated_at":"2017-06-08T04:34:19Z","closed_at":"2017-06-08T04:34:19Z","body":"### [REQUIRED] Describe your environment\r\n\r\n  * Operating System version: Linux & Windows 10\r\n  * Firebase SDK version: 4.1.1\r\n  * Firebase Product: storage\r\n\r\n### [REQUIRED] Describe the problem\r\n[According to the documentation](https://firebase.google.com/docs/reference/js/firebase.storage.UploadTask#on), the `nextOrObserver` parameter for the `firebase.storage.UploadTask#on` method should accept an observer with only **some** of the methods: `next`, `complete`, and `error`.\r\n\r\nThat means this should be allowed:\r\n```ts\r\nuploadTask.on(TaskEvent.STATE_CHANGED, {\r\n  next: (snapshot) => { console.log(snapshot); },\r\n  error: (err) => { console.error(err); }\r\n});\r\n```\r\n\r\nThis, though, raises the following error: `TypeError: Cannot read property 'bind' of undefined` since `observer.complete` is `undefined`. Relevant code [here](https://github.com/firebase/firebase-js-sdk/blob/c054dab68ce4d30af7fcb0bb850f1a064ba023c5/src/storage/task.ts#L570).\r\n\r\nCurrently, the only workaround besides providing an actual method is this:\r\n```ts\r\nuploadTask.on(TaskEvent.STATE_CHANGED, {\r\n  next: (snapshot) => { console.log(snapshot); },\r\n  error: (err) => { console.error(err); },\r\n  complete: null\r\n});\r\n```\r\n\r\n#### Steps to reproduce:\r\nSee JS Bin link below.\r\n\r\n#### Relevant Code:\r\nhttp://jsbin.com/yujaraboma/1/edit?js,console\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/comments/306995673","html_url":"https://github.com/firebase/firebase-js-sdk/issues/40#issuecomment-306995673","issue_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/40","id":306995673,"user":{"login":"jsayol","id":2029586,"avatar_url":"https://avatars2.githubusercontent.com/u/2029586?v=3","gravatar_id":"","url":"https://api.github.com/users/jsayol","html_url":"https://github.com/jsayol","followers_url":"https://api.github.com/users/jsayol/followers","following_url":"https://api.github.com/users/jsayol/following{/other_user}","gists_url":"https://api.github.com/users/jsayol/gists{/gist_id}","starred_url":"https://api.github.com/users/jsayol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsayol/subscriptions","organizations_url":"https://api.github.com/users/jsayol/orgs","repos_url":"https://api.github.com/users/jsayol/repos","events_url":"https://api.github.com/users/jsayol/events{/privacy}","received_events_url":"https://api.github.com/users/jsayol/received_events","type":"User","site_admin":false},"created_at":"2017-06-08T04:34:19Z","updated_at":"2017-06-08T04:34:19Z","body":"PR merged, closing!"}}
{"actor":{"display_login":"jsayol"}}