{"id":3125,"date":"2021-07-25T21:58:00","date_gmt":"2021-07-25T09:58:00","guid":{"rendered":"https:\/\/www.talkcrypto.org\/blog\/?p=3125"},"modified":"2023-11-27T19:28:01","modified_gmt":"2023-11-27T06:28:01","slug":"debugging-subquery-project-with-debugger","status":"publish","type":"post","link":"https:\/\/www.talkcrypto.org\/blog\/2021\/07\/25\/debugging-subquery-project-with-debugger\/","title":{"rendered":"Debugging SubQuery project with debugger"},"content":{"rendered":"\n<p>To debug a SubQuery project, the &#8211;inspect flag of the node command needs to be used. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"594\" height=\"89\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/image-1.png\" alt=\"\" class=\"wp-image-3126\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/image-1.png 594w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/image-1-300x45.png 300w\" sizes=\"(max-width: 594px) 100vw, 594px\" \/><\/figure>\n\n\n\n<p>The command is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><meta charset=\"utf-8\">node --inspect-brk &lt;path to subql-node> -f &lt;path to subQuery project><\/code><\/pre>\n\n\n\n<p>Eg:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node --inspect-brk \/usr\/local\/bin\/subql-node -f ~\/Code\/subQuery\/projects\/subql-helloworld\/<\/code><\/pre>\n\n\n\n<p>This enables the <a rel=\"noreferrer noopener\" href=\"https:\/\/nodejs.org\/en\/docs\/guides\/debugging-getting-started\/\" target=\"_blank\">node inspector<\/a>. Note the small difference between &#8211;inspect and &#8211;inspect-brk. Then open up the Developer Tools in Chrome and you should see a green icon appear.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"616\" height=\"152\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/image-2.png\" alt=\"\" class=\"wp-image-3128\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/image-2.png 616w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/image-2-300x74.png 300w\" sizes=\"(max-width: 616px) 100vw, 616px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"480\" height=\"270\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/nodeinspect.gif\" alt=\"\" class=\"wp-image-3127\"\/><\/figure>\n\n\n\n<p>Clicking on the green icon will open up the DevTools.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"740\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-5.48.09-pm-1024x740.png\" alt=\"\" class=\"wp-image-3129\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-5.48.09-pm-1024x740.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-5.48.09-pm-300x217.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-5.48.09-pm-768x555.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-5.48.09-pm.png 1202w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>From here, navigate to the &#8220;Filesystem&#8221; and add your project folder to the workspace. Then you can add breakpoints and step through your code just like any regular debugger.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"600\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-7.06.45-pm-1024x600.png\" alt=\"\" class=\"wp-image-3130\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-7.06.45-pm-1024x600.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-7.06.45-pm-300x176.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-7.06.45-pm-768x450.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-16-at-7.06.45-pm.png 1090w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To debug a SubQuery project, the &#8211;inspect flag of the<\/p>\n","protected":false},"author":1,"featured_media":3397,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3125","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blockchain"],"featured_image_urls":{"full":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1.jpg",612,389,false],"thumbnail":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1-150x150.jpg",150,150,true],"medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1-300x191.jpg",300,191,true],"medium_large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1.jpg",612,389,false],"large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1.jpg",612,389,false],"1536x1536":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1.jpg",612,389,false],"2048x2048":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1.jpg",612,389,false],"chromenews-featured":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1.jpg",612,389,false],"chromenews-large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1.jpg",612,389,false],"chromenews-medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/07\/debug-1-590x389.jpg",590,389,true]},"author_info":{"info":["seandotau"]},"category_info":"<a href=\"https:\/\/www.talkcrypto.org\/blog\/category\/blockchain\/\" rel=\"category tag\">Blockchain<\/a>","tag_info":"Blockchain","comment_count":"0","_links":{"self":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/3125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/comments?post=3125"}],"version-history":[{"count":1,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/3125\/revisions"}],"predecessor-version":[{"id":3131,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/3125\/revisions\/3131"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media\/3397"}],"wp:attachment":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media?parent=3125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/categories?post=3125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/tags?post=3125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}