{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1566","repository_url":"https://api.github.com/repos/aws/aws-sdk-js","labels_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1566/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1566/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1566/events","html_url":"https://github.com/aws/aws-sdk-js/issues/1566","id":235454352,"node_id":"MDU6SXNzdWUyMzU0NTQzNTI=","number":1566,"title":"error: Uncaught TypeError: Cannot read property 'crypto' of undefined in browser, when using webpack","user":{"login":"SanderElias","id":1249083,"node_id":"MDQ6VXNlcjEyNDkwODM=","avatar_url":"https://avatars0.githubusercontent.com/u/1249083?v=4","gravatar_id":"","url":"https://api.github.com/users/SanderElias","html_url":"https://github.com/SanderElias","followers_url":"https://api.github.com/users/SanderElias/followers","following_url":"https://api.github.com/users/SanderElias/following{/other_user}","gists_url":"https://api.github.com/users/SanderElias/gists{/gist_id}","starred_url":"https://api.github.com/users/SanderElias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanderElias/subscriptions","organizations_url":"https://api.github.com/users/SanderElias/orgs","repos_url":"https://api.github.com/users/SanderElias/repos","events_url":"https://api.github.com/users/SanderElias/events{/privacy}","received_events_url":"https://api.github.com/users/SanderElias/received_events","type":"User","site_admin":false},"labels":[{"id":13276310,"node_id":"MDU6TGFiZWwxMzI3NjMxMA==","url":"https://api.github.com/repos/aws/aws-sdk-js/labels/Question","name":"Question","color":"cc317c","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2017-06-13T06:59:59Z","updated_at":"2018-09-18T14:58:26Z","closed_at":"2017-09-06T15:18:50Z","author_association":"NONE","body":"This issue was raised already in #1512 first. Using the solution in there did not resolve it for me.\r\n\r\nThere is an ancient version of `crypto-browserify` (1.0.9) included in aws. This broke my build. \r\nI tried to update that dependency to the latest version, but that broke aws-sdk completely. \r\n\r\nthe culprit is line 4 in `rng.ks` (sorry, can't put a link here, seems not to be available on git anymore)\r\n\r\n```\r\n  var _global = this;\r\n```\r\nIn strict mode the this will be undefined. \r\nWhen replaced by: \r\n```\r\n  var _global = this || window || {};\r\n```\r\nit will not error out anymore, but changing files in node_modules isn't very stable. (slight understatement there!)"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-js/issues/comments/422428509","html_url":"https://github.com/aws/aws-sdk-js/issues/1566#issuecomment-422428509","issue_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1566","id":422428509,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjQyODUwOQ==","user":{"login":"andersforsell","id":1157421,"node_id":"MDQ6VXNlcjExNTc0MjE=","avatar_url":"https://avatars3.githubusercontent.com/u/1157421?v=4","gravatar_id":"","url":"https://api.github.com/users/andersforsell","html_url":"https://github.com/andersforsell","followers_url":"https://api.github.com/users/andersforsell/followers","following_url":"https://api.github.com/users/andersforsell/following{/other_user}","gists_url":"https://api.github.com/users/andersforsell/gists{/gist_id}","starred_url":"https://api.github.com/users/andersforsell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersforsell/subscriptions","organizations_url":"https://api.github.com/users/andersforsell/orgs","repos_url":"https://api.github.com/users/andersforsell/repos","events_url":"https://api.github.com/users/andersforsell/events{/privacy}","received_events_url":"https://api.github.com/users/andersforsell/received_events","type":"User","site_admin":false},"created_at":"2018-09-18T14:58:26Z","updated_at":"2018-09-18T14:58:26Z","author_association":"NONE","body":"I am still seeing this issue:\r\n```\r\nrng.js:21 Uncaught TypeError: Cannot read property 'crypto' of undefined\r\n    at rng.js:21\r\n    at Object.<anonymous> (rng.js:31)\r\n    at Object../node_modules/amazon-cognito-identity-js/node_modules/crypto-browserify/rng.js (rng.js:31)\r\n    at __webpack_require__ (bootstrap:63)\r\n    at Object.<anonymous> (index.js:4)\r\n    at Object.<anonymous> (index.js:97)\r\n    at Object../node_modules/amazon-cognito-identity-js/node_modules/crypto-browserify/index.js (index.js:97)\r\n    at __webpack_require__ (bootstrap:63)\r\n    at Object../node_modules/amazon-cognito-identity-js/es/AuthenticationHelper.js (AuthenticationDetails.js:84)\r\n    at __webpack_require__ (bootstrap:63)\r\n```\r\nMy dependencies in package.json:\r\n```\r\n\"dependencies\": {\r\n    \"ajv-keywords\": \"^3.2.0\",\r\n    \"apollo-client\": \"^2.3.8\",\r\n    \"aws-amplify\": \"^1.0.8\",\r\n    \"aws-appsync\": \"^1.3.4\",\r\n    \"graphql\": \"^0.13.2\",\r\n    \"graphql-tag\": \"^2.9.2\",\r\n    \"regenerator-runtime\": \"^0.11.1\",\r\n    \"uuid\": \"^3.1.0\"\r\n  },\r\n```\r\n\r\nIn package-lock.json there is a dependency to crypto-browserify:\r\n```\r\n    \"amazon-cognito-identity-js\": {\r\n      \"version\": \"2.0.23\",\r\n      \"resolved\": \"https://registry.npmjs.org/amazon-cognito-identity-js/-/amazon-cognito-identity-js-2.0.23.tgz\",\r\n      \"integrity\": \"sha512-TRZEphGFIPgrMNuFlAzr7ZhZfqkEMDNFXD5OI9ZL/iw+D3e2xHw0FHyaN3fWW06ZRiBvJUHAXPnOV0ON40e/ng==\",\r\n      \"requires\": {\r\n        \"buffer\": \"4.9.1\",\r\n        \"crypto-browserify\": \"1.0.9\",\r\n        \"js-cookie\": \"2.2.0\"\r\n      }\r\n    },\r\n```"}}
{"actor":{"display_login":"andersforsell"}}