<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do you debug JS in Splunk 7? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-debug-JS-in-Splunk-7/m-p/305345#M19433</link>
    <description>&lt;P&gt;We just made the switch from Splunk 6.2.3 to Splunk 7.0.1 and a lot of our custom JS broke.  I am trying to debug through and make changes where necessary, but I can't seem to use any of my browsers (Chrome, Firefox, IE) to debug.  With Splunk 6.2.3, I used to be able to view my JS files in the web console and add breakpoints.  It seems like with Splunk 7.0.1, I can add JS and have it work, but I can't add breakpoints to my source because I can't find it in the web console.&lt;/P&gt;

&lt;P&gt;For example, here are the steps I took to reproduce this:&lt;BR /&gt;
1. Create a new app (called test)&lt;BR /&gt;
2. Create a directory under &lt;CODE&gt;$SPLUNK_HOME/etc/apps/test/appserver/static/&lt;/CODE&gt;&lt;BR /&gt;
3. Added a JS file in &lt;CODE&gt;$SPLUNK_HOME/etc/apps/test/appserver/static/hello.js&lt;/CODE&gt;.  Code is just a simple &lt;CODE&gt;console.log("Hello");&lt;/CODE&gt;&lt;BR /&gt;
4. Created a dashboard in the test app.&lt;BR /&gt;
5. Linked new dashboard to hello.js. &lt;CODE&gt;&amp;lt;dashboard script="hello.js"&amp;gt;...&lt;/CODE&gt;&lt;BR /&gt;
6. Restarted splunk&lt;BR /&gt;
7. Navigate to the new dashboard&lt;BR /&gt;
8. Opened web console&lt;/P&gt;

&lt;P&gt;In Splunk 6.2.3, the console output looks like:&lt;BR /&gt;
&lt;CODE&gt;Hello                                                                                                               hello.js:6:1&lt;/CODE&gt;&lt;BR /&gt;
I can then click on &lt;CODE&gt;hello.js:6:1&lt;/CODE&gt; and navigate to the JS source, add breakpoints, etc...&lt;/P&gt;

&lt;P&gt;In Splunk 7.0.1, the console output looks like:&lt;BR /&gt;
&lt;CODE&gt;Hello                                                                                     common.js%20line%2014%20%3E%20eval:5:1&lt;/CODE&gt;&lt;BR /&gt;
If if click on &lt;CODE&gt;common.js%20line%2014%20%3E%20eval:5:1&lt;/CODE&gt;, it navigates me to &lt;CODE&gt;view-source:http://&amp;lt;splunk_hostname&amp;gt;:&amp;lt;splunk_port&amp;gt;/en-US/static/&amp;lt;uid&amp;gt;/build/pages/enterprise/common.js line %3E eval&lt;/CODE&gt; and I get a "Page not found".&lt;/P&gt;

&lt;P&gt;I can navigate to &lt;CODE&gt;&lt;A href="http://&amp;lt;splunk_hostname&amp;gt;:&amp;lt;splunk_port&amp;gt;/static/app/test/hello.js" target="test_blank"&gt;http://&amp;lt;splunk_hostname&amp;gt;:&amp;lt;splunk_port&amp;gt;/static/app/test/hello.js&lt;/A&gt;&lt;/CODE&gt; with both 6.2.3 and 7.0.1.  How do I make it so I can debug my JS in Splunk 7.0.1?&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2018 19:45:54 GMT</pubDate>
    <dc:creator>eroffol</dc:creator>
    <dc:date>2018-02-22T19:45:54Z</dc:date>
    <item>
      <title>How do you debug JS in Splunk 7?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-debug-JS-in-Splunk-7/m-p/305345#M19433</link>
      <description>&lt;P&gt;We just made the switch from Splunk 6.2.3 to Splunk 7.0.1 and a lot of our custom JS broke.  I am trying to debug through and make changes where necessary, but I can't seem to use any of my browsers (Chrome, Firefox, IE) to debug.  With Splunk 6.2.3, I used to be able to view my JS files in the web console and add breakpoints.  It seems like with Splunk 7.0.1, I can add JS and have it work, but I can't add breakpoints to my source because I can't find it in the web console.&lt;/P&gt;

&lt;P&gt;For example, here are the steps I took to reproduce this:&lt;BR /&gt;
1. Create a new app (called test)&lt;BR /&gt;
2. Create a directory under &lt;CODE&gt;$SPLUNK_HOME/etc/apps/test/appserver/static/&lt;/CODE&gt;&lt;BR /&gt;
3. Added a JS file in &lt;CODE&gt;$SPLUNK_HOME/etc/apps/test/appserver/static/hello.js&lt;/CODE&gt;.  Code is just a simple &lt;CODE&gt;console.log("Hello");&lt;/CODE&gt;&lt;BR /&gt;
4. Created a dashboard in the test app.&lt;BR /&gt;
5. Linked new dashboard to hello.js. &lt;CODE&gt;&amp;lt;dashboard script="hello.js"&amp;gt;...&lt;/CODE&gt;&lt;BR /&gt;
6. Restarted splunk&lt;BR /&gt;
7. Navigate to the new dashboard&lt;BR /&gt;
8. Opened web console&lt;/P&gt;

&lt;P&gt;In Splunk 6.2.3, the console output looks like:&lt;BR /&gt;
&lt;CODE&gt;Hello                                                                                                               hello.js:6:1&lt;/CODE&gt;&lt;BR /&gt;
I can then click on &lt;CODE&gt;hello.js:6:1&lt;/CODE&gt; and navigate to the JS source, add breakpoints, etc...&lt;/P&gt;

&lt;P&gt;In Splunk 7.0.1, the console output looks like:&lt;BR /&gt;
&lt;CODE&gt;Hello                                                                                     common.js%20line%2014%20%3E%20eval:5:1&lt;/CODE&gt;&lt;BR /&gt;
If if click on &lt;CODE&gt;common.js%20line%2014%20%3E%20eval:5:1&lt;/CODE&gt;, it navigates me to &lt;CODE&gt;view-source:http://&amp;lt;splunk_hostname&amp;gt;:&amp;lt;splunk_port&amp;gt;/en-US/static/&amp;lt;uid&amp;gt;/build/pages/enterprise/common.js line %3E eval&lt;/CODE&gt; and I get a "Page not found".&lt;/P&gt;

&lt;P&gt;I can navigate to &lt;CODE&gt;&lt;A href="http://&amp;lt;splunk_hostname&amp;gt;:&amp;lt;splunk_port&amp;gt;/static/app/test/hello.js" target="test_blank"&gt;http://&amp;lt;splunk_hostname&amp;gt;:&amp;lt;splunk_port&amp;gt;/static/app/test/hello.js&lt;/A&gt;&lt;/CODE&gt; with both 6.2.3 and 7.0.1.  How do I make it so I can debug my JS in Splunk 7.0.1?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 19:45:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-debug-JS-in-Splunk-7/m-p/305345#M19433</guid>
      <dc:creator>eroffol</dc:creator>
      <dc:date>2018-02-22T19:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do you debug JS in Splunk 7?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-debug-JS-in-Splunk-7/m-p/305346#M19434</link>
      <description>&lt;P&gt;It looks like I lost some formatting.  Here is the revised end to my question:&lt;BR /&gt;
In Splunk 6.2.3, the console output looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Hello                                                                                            hello.js:6:1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can then click on &lt;CODE&gt;hello.js:6:1&lt;/CODE&gt; and navigate to the JS source, add breakpoints, etc...&lt;/P&gt;

&lt;P&gt;In Splunk 7.0.1, the console output looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Hello                                                                  common.js%20line%2014%20%3E%20eval:5:1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If if click on &lt;CODE&gt;common.js%20line%2014%20%3E%20eval:5:1&lt;/CODE&gt;, it navigates me to &lt;CODE&gt;view-source:http://:/en-US/static//build/pages/enterprise/common.js line %3E eval&lt;/CODE&gt; and I get a "Page not found".&lt;/P&gt;

&lt;P&gt;I can navigate to &lt;CODE&gt;&lt;A href="http://:/static/app/test/hello.js" target="test_blank"&gt;http://:/static/app/test/hello.js&lt;/A&gt;&lt;/CODE&gt; with both 6.2.3 and 7.0.1. How do I make it so I can debug my JS in Splunk 7.0.1?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 20:47:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-debug-JS-in-Splunk-7/m-p/305346#M19434</guid>
      <dc:creator>eroffol</dc:creator>
      <dc:date>2018-02-22T20:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do you debug JS in Splunk 7?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-debug-JS-in-Splunk-7/m-p/305347#M19435</link>
      <description>&lt;P&gt;The way js is loaded has changed from 6.2, see the &lt;A href="https://answers.splunk.com/answers/456860/why-are-javascript-files-not-loading-after-update-1.html"&gt;answers and discussions here&lt;/A&gt; (not the accepted answer, the ones below that).&lt;/P&gt;

&lt;P&gt;You've got several options, the easiest is to add the line&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;//# sourceURL=hello.js
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to the file and it'll appear in your debugger under that name.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 08:16:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-debug-JS-in-Splunk-7/m-p/305347#M19435</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2018-02-23T08:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do you debug JS in Splunk 7?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-debug-JS-in-Splunk-7/m-p/305348#M19436</link>
      <description>&lt;P&gt;Wow that was simple! Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 14:25:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-debug-JS-in-Splunk-7/m-p/305348#M19436</guid>
      <dc:creator>eroffol</dc:creator>
      <dc:date>2018-02-23T14:25:11Z</dc:date>
    </item>
  </channel>
</rss>

