{"action":"created","issue":{"url":"https://api.github.com/repos/MyPureCloud/purecloud-webrtc-sdk/issues/9","repository_url":"https://api.github.com/repos/MyPureCloud/purecloud-webrtc-sdk","labels_url":"https://api.github.com/repos/MyPureCloud/purecloud-webrtc-sdk/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/MyPureCloud/purecloud-webrtc-sdk/issues/9/comments","events_url":"https://api.github.com/repos/MyPureCloud/purecloud-webrtc-sdk/issues/9/events","html_url":"https://github.com/MyPureCloud/purecloud-webrtc-sdk/issues/9","id":347141978,"node_id":"MDU6SXNzdWUzNDcxNDE5Nzg=","number":9,"title":"Production Error \"Uncaught TypeError: r.emit is not a function\"","user":{"login":"samueljun","id":1808588,"node_id":"MDQ6VXNlcjE4MDg1ODg=","avatar_url":"https://avatars1.githubusercontent.com/u/1808588?v=4","gravatar_id":"","url":"https://api.github.com/users/samueljun","html_url":"https://github.com/samueljun","followers_url":"https://api.github.com/users/samueljun/followers","following_url":"https://api.github.com/users/samueljun/following{/other_user}","gists_url":"https://api.github.com/users/samueljun/gists{/gist_id}","starred_url":"https://api.github.com/users/samueljun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samueljun/subscriptions","organizations_url":"https://api.github.com/users/samueljun/orgs","repos_url":"https://api.github.com/users/samueljun/repos","events_url":"https://api.github.com/users/samueljun/events{/privacy}","received_events_url":"https://api.github.com/users/samueljun/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-08-02T19:22:19Z","updated_at":"2018-08-06T19:16:38Z","closed_at":null,"author_association":"NONE","body":"I'm currently seeing a production-only TypeError when initializing the SDK. Local doesn't have any issues but when transpiling and bundling using browserify (+ babelify + uglify), the error pops up.\r\n\r\nHere is the type error that is being thrown in the console:\r\n\r\n```js\r\npurecloud-webrtc-sdk.js:1 Uncaught TypeError: r.emit is not a function\r\n    at XMLHttpRequest.t.onreadystatechange (purecloud-webrtc-sdk.js:1)\r\nt.onreadystatechange @ purecloud-webrtc-sdk.js:1\r\nXMLHttpRequest.send (async)\r\nu._end @ purecloud-webrtc-sdk.js:1\r\nu.end @ purecloud-webrtc-sdk.js:1\r\n(anonymous) @ purecloud-webrtc-sdk.js:1\r\nt @ es6-shim.js:1663\r\nr.then @ purecloud-webrtc-sdk.js:1\r\nvalue @ purecloud-webrtc-sdk.js:1\r\nvalue @ index.js:36                        // The line here is _sdk.intitialize()_\r\ncommitLifeCycles @ react-dom.production.min.js:159\r\nw @ react-dom.production.min.js:185\r\n_ @ react-dom.production.min.js:182\r\ny @ react-dom.production.min.js:181\r\nb @ react-dom.production.min.js:181\r\nh @ react-dom.production.min.js:180\r\nc @ react-dom.production.min.js:179\r\nt @ react-dom.production.min.js:190\r\nupdateContainer @ react-dom.production.min.js:191\r\nnn.render @ react-dom.production.min.js:228\r\n(anonymous) @ react-dom.production.min.js:242\r\nunbatchedUpdates @ react-dom.production.min.js:188\r\nsn @ react-dom.production.min.js:242\r\nrender @ react-dom.production.min.js:244\r\n354.../platform/teams/u4b/utils/constants @ routes.jsx:252\r\no @ _prelude.js:1\r\n(anonymous) @ _prelude.js:1\r\n366../components/routes.jsx @ main.js:48971\r\no @ _prelude.js:1\r\ne @ _prelude.js:1\r\n(anonymous) @ _prelude.js:1\r\n```\r\n\r\nIf I manually go into `node_modules/purecloud-webrtc-sdk/web/purecloud-webrtc-sdk.js` to format the file with Prettier for a better stack trace, it looks like the line that's being thrown is here:\r\n\r\n```js\r\n        (_.prototype._end = function() {\r\n          var t = this,\r\n            e = (this.xhr = l.getXHR()),\r\n            n = this._formData || this._data;\r\n          this._setTimeouts(),\r\n            (e.onreadystatechange = function() {\r\n              var n = e.readyState;\r\n              if (\r\n                (n >= 2 &&\r\n                  t._responseTimeoutTimer &&\r\n                  clearTimeout(t._responseTimeoutTimer),\r\n                4 == n)\r\n              ) {\r\n                var r;\r\n                try {\r\n                  r = e.status;\r\n                } catch (t) {\r\n                  r = 0;\r\n                }\r\n                if (!r) {\r\n                  if (t.timedout || t._aborted) return;\r\n                  return t.crossDomainError();\r\n                }\r\n                t.emit(\"end\"); // LINE 831 This is where emit is not a function\r\n              }\r\n            });\r\n          var r = function(e, n) {\r\n            n.total > 0 && (n.percent = (n.loaded / n.total) * 100),\r\n              (n.direction = e),\r\n              t.emit(\"progress\", n);\r\n          };\r\n\r\n```\r\n\r\nI'm still debugging and trying to isolate the issue but was wondering if you had seen this before and knew what the issue is.\r\n"},"comment":{"url":"https://api.github.com/repos/MyPureCloud/purecloud-webrtc-sdk/issues/comments/410822083","html_url":"https://github.com/MyPureCloud/purecloud-webrtc-sdk/issues/9#issuecomment-410822083","issue_url":"https://api.github.com/repos/MyPureCloud/purecloud-webrtc-sdk/issues/9","id":410822083,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDgyMjA4Mw==","user":{"login":"samueljun","id":1808588,"node_id":"MDQ6VXNlcjE4MDg1ODg=","avatar_url":"https://avatars1.githubusercontent.com/u/1808588?v=4","gravatar_id":"","url":"https://api.github.com/users/samueljun","html_url":"https://github.com/samueljun","followers_url":"https://api.github.com/users/samueljun/followers","following_url":"https://api.github.com/users/samueljun/following{/other_user}","gists_url":"https://api.github.com/users/samueljun/gists{/gist_id}","starred_url":"https://api.github.com/users/samueljun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samueljun/subscriptions","organizations_url":"https://api.github.com/users/samueljun/orgs","repos_url":"https://api.github.com/users/samueljun/repos","events_url":"https://api.github.com/users/samueljun/events{/privacy}","received_events_url":"https://api.github.com/users/samueljun/received_events","type":"User","site_admin":false},"created_at":"2018-08-06T19:16:38Z","updated_at":"2018-08-06T19:16:38Z","author_association":"NONE","body":"Thanks for testing the other versions! I appreciate the quick response and support. It is unfortunately time-prohibitive for us to upgrade at the moment. But I'll look into upgrading in the future. Thanks!"}}
{"actor":{"display_login":"samueljun"}}