{"action":"created","issue":{"url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3786","repository_url":"https://api.github.com/repos/reactioncommerce/reaction","labels_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3786/labels{/name}","comments_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3786/comments","events_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3786/events","html_url":"https://github.com/reactioncommerce/reaction/issues/3786","id":298020847,"number":3786,"title":"Braintree API call paymentSubmit results in error (release-1.8.0) ","user":{"login":"prinzdezibel","id":1733229,"avatar_url":"https://avatars3.githubusercontent.com/u/1733229?v=4","gravatar_id":"","url":"https://api.github.com/users/prinzdezibel","html_url":"https://github.com/prinzdezibel","followers_url":"https://api.github.com/users/prinzdezibel/followers","following_url":"https://api.github.com/users/prinzdezibel/following{/other_user}","gists_url":"https://api.github.com/users/prinzdezibel/gists{/gist_id}","starred_url":"https://api.github.com/users/prinzdezibel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prinzdezibel/subscriptions","organizations_url":"https://api.github.com/users/prinzdezibel/orgs","repos_url":"https://api.github.com/users/prinzdezibel/repos","events_url":"https://api.github.com/users/prinzdezibel/events{/privacy}","received_events_url":"https://api.github.com/users/prinzdezibel/received_events","type":"User","site_admin":false},"labels":[{"id":377481506,"url":"https://api.github.com/repos/reactioncommerce/reaction/labels/bug","name":"bug","color":"ff3737","default":true},{"id":503734431,"url":"https://api.github.com/repos/reactioncommerce/reaction/labels/cannot-reproduce","name":"cannot-reproduce","color":"1d76db","default":false},{"id":695679879,"url":"https://api.github.com/repos/reactioncommerce/reaction/labels/impact-major","name":"impact-major","color":"d93f0b","default":false},{"id":831580417,"url":"https://api.github.com/repos/reactioncommerce/reaction/labels/regression","name":"regression","color":"ea4473","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-02-17T17:24:04Z","updated_at":"2018-02-18T10:00:25Z","closed_at":null,"author_association":"MEMBER","body":"Checking out with Braintree causes a server side error in release-1.8.0, because in package-lock.json [braintree bindings](https://github.com/braintree/braintree_node) are pinned to 2.6.0, which is incompatible with the current code base. The package is pinned to 2.4.0 in master branch.\r\n\r\n### Expected behavior\r\nCheckout with braintree should work without error\r\n\r\n### Actual behavior\r\n\r\nA server side error is thrown:\r\n```\r\nERROR Reaction: Maximum call stack size exceeded\r\n  RangeError: Maximum call stack size exceeded\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n      at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)\r\n      at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)\r\n      at Array.forEach (<anonymous>)\r\n```\r\n\r\n### Steps to reproduce the behavior\r\n- As an admin, enable braintree\r\n- As a user put an item to cart and checkout\r\n- After entering the credentials, a server side error occurs.\r\n\r\n\r\n### Analysis\r\nThe failure in braintree 2.6.0 happens because the paymentSubmit API call returns an result object with a circular reference (BraintreeGateway). This causes EJSON serialization to fail:\r\n```\r\nEJSON.stringify(paymentSubmitResult)\r\n\r\nejson.js:594 Uncaught RangeError: Maximum call stack size exceeded\r\n  [.. much more repetitive output ..]\r\n```\r\n\r\n### Versions\r\nNode: 8.2.1\r\nNPM: 5.3.0\r\nMeteor Node: 8.9.4\r\nMeteor NPM: 5.6.0\r\nReaction CLI: 0.26.4\r\nReaction: 1.8.0\r\nReaction branch: release-1.8.0\r\nDocker: 17.03.1-ce\r\n"},"comment":{"url":"https://api.github.com/repos/reactioncommerce/reaction/issues/comments/366504763","html_url":"https://github.com/reactioncommerce/reaction/issues/3786#issuecomment-366504763","issue_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3786","id":366504763,"user":{"login":"zenweasel","id":72819,"avatar_url":"https://avatars1.githubusercontent.com/u/72819?v=4","gravatar_id":"","url":"https://api.github.com/users/zenweasel","html_url":"https://github.com/zenweasel","followers_url":"https://api.github.com/users/zenweasel/followers","following_url":"https://api.github.com/users/zenweasel/following{/other_user}","gists_url":"https://api.github.com/users/zenweasel/gists{/gist_id}","starred_url":"https://api.github.com/users/zenweasel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zenweasel/subscriptions","organizations_url":"https://api.github.com/users/zenweasel/orgs","repos_url":"https://api.github.com/users/zenweasel/repos","events_url":"https://api.github.com/users/zenweasel/events{/privacy}","received_events_url":"https://api.github.com/users/zenweasel/received_events","type":"User","site_admin":false},"created_at":"2018-02-18T10:00:25Z","updated_at":"2018-02-18T10:00:25Z","author_association":"MEMBER","body":"Maybe this is the problem, looks like there might be discrenpency betwee package.json and package-lock.json\r\n```\r\n »» cat package.json | grep -i braintree\r\n    \"braintree\": \"^2.7.0\",\r\n\r\n[brenthoover@sloat: 17:58:31 ~/Projects/js/reaction  (release-1.8.0 $) - [1153]\r\n »» cat package-lock.json | grep -i braintree\r\n    \"@braintree/wrap-promise\": {\r\n      \"resolved\": \"https://registry.npmjs.org/@braintree/wrap-promise/-/wrap-promise-1.1.1.tgz\",\r\n    \"braintree\": {\r\n      \"resolved\": \"https://registry.npmjs.org/braintree/-/braintree-2.6.0.tgz\",\r\n        \"@braintree/wrap-promise\": \"1.1.1\",\r\n```"}}
{"actor":{"display_login":"zenweasel"}}