{"action":"created","comment":{"url":"https://api.github.com/repos/coveo/source.coveo.com/pulls/comments/89867515","pull_request_review_id":10398783,"id":89867515,"diff_hunk":"@@ -0,0 +1,68 @@\n+---\n+layout: post\n+\n+title: Debugging Salesforce Lightning Components\n+tags: \"salesforce debug lightning locker service community aura\"\n+\n+author:\n+  name: Marc-Antoine Veilleux\n+  bio: Coveo for Salesforce Team Lead\n+  image: maveilleux.jpg\n+---\n+\n+For almost a year, Coveo has been offering Lightning components in Salesforce as part of its search offering. Over time, we had to develop new ways to debug them inside and outside of a developer environment. Here are some tips and tricks we discovered, which might help you debug Lightning components.\n+\n+<!-- more -->\n+\n+## Enable the Debug Mode\n+\n+\n+First and foremost, to make things easier to develop, enable the Debug Mode for Lightning Components. This helps you understand what is happening, and allows Chrome to load the debugger when needed; minified code can be difficult to load and can make Chrome lag.\n+\n+![Enable lightning debug mode]({{\"/images/posts/debugging-salesforce/enable-lightning-debug.jpg\" | relative_url }})\n+\n+## Install the Salesforce Lightning Inspector\n+\n+\n+Second, install the Salesforce Lightning Inspector and the Salesforce Developer Tool Suite.\n+The Salesforce Lightning Inspector adds a tab in your Chrome developer tools. Simply browse to a Lightning page, and you will see the Lightning tab appear.\n+\n+![The lightning extension]({{\"/images/posts/debugging-salesforce/lightning-tab.jpg\" | relative_url }})\n+\n+The Lightning inspector gives you information about the state of a page/component with the current attribute’s values, information about the performance, a transactions log, an event log, and the current storage.\n+\n+\n+If you have the [`@AuraEnabled` apex method](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_AuraEnabled.htm), you need to check the logs. This is where the Salesforce Developer Tool suite comes in handy. The trick is to open the extension in the Salesforce Administration tool and click New Window. Set up your user like you would with regular Salesforce logs; you can now start having some fun with your community.\n+\n+![Retrieving logs]({{\"/images/posts/debugging-salesforce/concrete-io.png\" | relative_url }})\n+\n+\n+From there, you’ll be able to see the logs for the Aura Enabled method in real time. Simply add `System.debug(‘foobar’)` in your apex method to get the information you need.\n+\n+## Debugging JavaScript Errors\n+\n+In your JavaScript code (Renderer, Controller, or Helper), you can start a debugging session using the JavaScript `debugger` keyword. Simply add it to your code at the place you want to debug; Chrome will stop running the code when hitting the keyword.\n+\n+\n+While this always works, it can be slightly cumbersome. There are occasions when you can’t change the code, for instance in a managed package with Lightning components. To debug these, you must use the source tab in your Chrome Developer Tools.\n+For instance, let’s say that you are trying to debug your Lightning component, and get a big red popup message with a poorly written error message.\n+First, in the Chrome Developer Tools, under the Sources tab, enable the `Pause on exceptions` button. This pauses the code on the `Aura` exception thrown when there are exceptions in your components.","path":"_posts/2016-11-25-debugging-lightning.md","position":null,"original_position":49,"commit_id":"75c0db1ca4f3c8dfbdcc2959adb6a0ec81a8ac46","original_commit_id":"e968317ce2307f5625c2dface39101534ae4dc4d","user":{"login":"erocheleau","id":2488155,"avatar_url":"https://avatars.githubusercontent.com/u/2488155?v=3","gravatar_id":"","url":"https://api.github.com/users/erocheleau","html_url":"https://github.com/erocheleau","followers_url":"https://api.github.com/users/erocheleau/followers","following_url":"https://api.github.com/users/erocheleau/following{/other_user}","gists_url":"https://api.github.com/users/erocheleau/gists{/gist_id}","starred_url":"https://api.github.com/users/erocheleau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erocheleau/subscriptions","organizations_url":"https://api.github.com/users/erocheleau/orgs","repos_url":"https://api.github.com/users/erocheleau/repos","events_url":"https://api.github.com/users/erocheleau/events{/privacy}","received_events_url":"https://api.github.com/users/erocheleau/received_events","type":"User","site_admin":false},"body":"> This pauses the code on the `Aura` exceptions thrown by lightning components.\r\n\r\nJuste ca.","created_at":"2016-11-28T19:48:09Z","updated_at":"2016-11-28T19:48:17Z","html_url":"https://github.com/coveo/source.coveo.com/pull/97#discussion_r89867515","pull_request_url":"https://api.github.com/repos/coveo/source.coveo.com/pulls/97","_links":{"self":{"href":"https://api.github.com/repos/coveo/source.coveo.com/pulls/comments/89867515"},"html":{"href":"https://github.com/coveo/source.coveo.com/pull/97#discussion_r89867515"},"pull_request":{"href":"https://api.github.com/repos/coveo/source.coveo.com/pulls/97"}}},"pull_request":{"url":"https://api.github.com/repos/coveo/source.coveo.com/pulls/97","id":95350568,"html_url":"https://github.com/coveo/source.coveo.com/pull/97","diff_url":"https://github.com/coveo/source.coveo.com/pull/97.diff","patch_url":"https://github.com/coveo/source.coveo.com/pull/97.patch","issue_url":"https://api.github.com/repos/coveo/source.coveo.com/issues/97","number":97,"state":"open","locked":false,"title":"New post about debugging salesforce lightning components","user":{"login":"marcantoineveilleux","id":6097684,"avatar_url":"https://avatars.githubusercontent.com/u/6097684?v=3","gravatar_id":"","url":"https://api.github.com/users/marcantoineveilleux","html_url":"https://github.com/marcantoineveilleux","followers_url":"https://api.github.com/users/marcantoineveilleux/followers","following_url":"https://api.github.com/users/marcantoineveilleux/following{/other_user}","gists_url":"https://api.github.com/users/marcantoineveilleux/gists{/gist_id}","starred_url":"https://api.github.com/users/marcantoineveilleux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcantoineveilleux/subscriptions","organizations_url":"https://api.github.com/users/marcantoineveilleux/orgs","repos_url":"https://api.github.com/users/marcantoineveilleux/repos","events_url":"https://api.github.com/users/marcantoineveilleux/events{/privacy}","received_events_url":"https://api.github.com/users/marcantoineveilleux/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-11-25T22:11:19Z","updated_at":"2016-11-28T19:48:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4dab888447106f35a601d183ae32e199bb0552f5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/coveo/source.coveo.com/pulls/97/commits","review_comments_url":"https://api.github.com/repos/coveo/source.coveo.com/pulls/97/comments","review_comment_url":"https://api.github.com/repos/coveo/source.coveo.com/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coveo/source.coveo.com/issues/97/comments","statuses_url":"https://api.github.com/repos/coveo/source.coveo.com/statuses/75c0db1ca4f3c8dfbdcc2959adb6a0ec81a8ac46","head":{"label":"marcantoineveilleux:gh-pages","ref":"gh-pages","sha":"75c0db1ca4f3c8dfbdcc2959adb6a0ec81a8ac46","user":{"login":"marcantoineveilleux","id":6097684,"avatar_url":"https://avatars.githubusercontent.com/u/6097684?v=3","gravatar_id":"","url":"https://api.github.com/users/marcantoineveilleux","html_url":"https://github.com/marcantoineveilleux","followers_url":"https://api.github.com/users/marcantoineveilleux/followers","following_url":"https://api.github.com/users/marcantoineveilleux/following{/other_user}","gists_url":"https://api.github.com/users/marcantoineveilleux/gists{/gist_id}","starred_url":"https://api.github.com/users/marcantoineveilleux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcantoineveilleux/subscriptions","organizations_url":"https://api.github.com/users/marcantoineveilleux/orgs","repos_url":"https://api.github.com/users/marcantoineveilleux/repos","events_url":"https://api.github.com/users/marcantoineveilleux/events{/privacy}","received_events_url":"https://api.github.com/users/marcantoineveilleux/received_events","type":"User","site_admin":false},"repo":{"id":64247580,"name":"source.coveo.com","full_name":"marcantoineveilleux/source.coveo.com","owner":{"login":"marcantoineveilleux","id":6097684,"avatar_url":"https://avatars.githubusercontent.com/u/6097684?v=3","gravatar_id":"","url":"https://api.github.com/users/marcantoineveilleux","html_url":"https://github.com/marcantoineveilleux","followers_url":"https://api.github.com/users/marcantoineveilleux/followers","following_url":"https://api.github.com/users/marcantoineveilleux/following{/other_user}","gists_url":"https://api.github.com/users/marcantoineveilleux/gists{/gist_id}","starred_url":"https://api.github.com/users/marcantoineveilleux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcantoineveilleux/subscriptions","organizations_url":"https://api.github.com/users/marcantoineveilleux/orgs","repos_url":"https://api.github.com/users/marcantoineveilleux/repos","events_url":"https://api.github.com/users/marcantoineveilleux/events{/privacy}","received_events_url":"https://api.github.com/users/marcantoineveilleux/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marcantoineveilleux/source.coveo.com","description":"Our technical blog.","fork":true,"url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com","forks_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/forks","keys_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/teams","hooks_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/hooks","issue_events_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/issues/events{/number}","events_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/events","assignees_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/assignees{/user}","branches_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/branches{/branch}","tags_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/tags","blobs_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/statuses/{sha}","languages_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/languages","stargazers_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/stargazers","contributors_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/contributors","subscribers_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/subscribers","subscription_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/subscription","commits_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/contents/{+path}","compare_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/merges","archive_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/downloads","issues_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/issues{/number}","pulls_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/pulls{/number}","milestones_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/milestones{/number}","notifications_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/labels{/name}","releases_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/releases{/id}","deployments_url":"https://api.github.com/repos/marcantoineveilleux/source.coveo.com/deployments","created_at":"2016-07-26T19:12:30Z","updated_at":"2016-07-26T19:12:31Z","pushed_at":"2016-11-28T19:12:29Z","git_url":"git://github.com/marcantoineveilleux/source.coveo.com.git","ssh_url":"git@github.com:marcantoineveilleux/source.coveo.com.git","clone_url":"https://github.com/marcantoineveilleux/source.coveo.com.git","svn_url":"https://github.com/marcantoineveilleux/source.coveo.com","homepage":"source.coveo.com","size":25497,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"gh-pages"}},"base":{"label":"coveo:gh-pages","ref":"gh-pages","sha":"443f2e264d6a291a54d7c7f3849fcb39cc22eb0b","user":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"repo":{"id":23815317,"name":"source.coveo.com","full_name":"coveo/source.coveo.com","owner":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coveo/source.coveo.com","description":"Our technical blog.","fork":false,"url":"https://api.github.com/repos/coveo/source.coveo.com","forks_url":"https://api.github.com/repos/coveo/source.coveo.com/forks","keys_url":"https://api.github.com/repos/coveo/source.coveo.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coveo/source.coveo.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coveo/source.coveo.com/teams","hooks_url":"https://api.github.com/repos/coveo/source.coveo.com/hooks","issue_events_url":"https://api.github.com/repos/coveo/source.coveo.com/issues/events{/number}","events_url":"https://api.github.com/repos/coveo/source.coveo.com/events","assignees_url":"https://api.github.com/repos/coveo/source.coveo.com/assignees{/user}","branches_url":"https://api.github.com/repos/coveo/source.coveo.com/branches{/branch}","tags_url":"https://api.github.com/repos/coveo/source.coveo.com/tags","blobs_url":"https://api.github.com/repos/coveo/source.coveo.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coveo/source.coveo.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coveo/source.coveo.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/coveo/source.coveo.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coveo/source.coveo.com/statuses/{sha}","languages_url":"https://api.github.com/repos/coveo/source.coveo.com/languages","stargazers_url":"https://api.github.com/repos/coveo/source.coveo.com/stargazers","contributors_url":"https://api.github.com/repos/coveo/source.coveo.com/contributors","subscribers_url":"https://api.github.com/repos/coveo/source.coveo.com/subscribers","subscription_url":"https://api.github.com/repos/coveo/source.coveo.com/subscription","commits_url":"https://api.github.com/repos/coveo/source.coveo.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/coveo/source.coveo.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/coveo/source.coveo.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/coveo/source.coveo.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/coveo/source.coveo.com/contents/{+path}","compare_url":"https://api.github.com/repos/coveo/source.coveo.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coveo/source.coveo.com/merges","archive_url":"https://api.github.com/repos/coveo/source.coveo.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coveo/source.coveo.com/downloads","issues_url":"https://api.github.com/repos/coveo/source.coveo.com/issues{/number}","pulls_url":"https://api.github.com/repos/coveo/source.coveo.com/pulls{/number}","milestones_url":"https://api.github.com/repos/coveo/source.coveo.com/milestones{/number}","notifications_url":"https://api.github.com/repos/coveo/source.coveo.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coveo/source.coveo.com/labels{/name}","releases_url":"https://api.github.com/repos/coveo/source.coveo.com/releases{/id}","deployments_url":"https://api.github.com/repos/coveo/source.coveo.com/deployments","created_at":"2014-09-09T01:43:19Z","updated_at":"2016-11-19T01:09:53Z","pushed_at":"2016-11-28T19:12:29Z","git_url":"git://github.com/coveo/source.coveo.com.git","ssh_url":"git@github.com:coveo/source.coveo.com.git","clone_url":"https://github.com/coveo/source.coveo.com.git","svn_url":"https://github.com/coveo/source.coveo.com","homepage":"source.coveo.com","size":25534,"stargazers_count":7,"watchers_count":7,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":39,"mirror_url":null,"open_issues_count":3,"forks":39,"open_issues":3,"watchers":7,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/coveo/source.coveo.com/pulls/97"},"html":{"href":"https://github.com/coveo/source.coveo.com/pull/97"},"issue":{"href":"https://api.github.com/repos/coveo/source.coveo.com/issues/97"},"comments":{"href":"https://api.github.com/repos/coveo/source.coveo.com/issues/97/comments"},"review_comments":{"href":"https://api.github.com/repos/coveo/source.coveo.com/pulls/97/comments"},"review_comment":{"href":"https://api.github.com/repos/coveo/source.coveo.com/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coveo/source.coveo.com/pulls/97/commits"},"statuses":{"href":"https://api.github.com/repos/coveo/source.coveo.com/statuses/75c0db1ca4f3c8dfbdcc2959adb6a0ec81a8ac46"}}}}
{"actor":{"display_login":"erocheleau"}}