1

I try to include StackTrace.js in my app but It didn't work.

I try with CDN putting :

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/1.0.1/stacktrace.min.js"></script>

in my index.html

But I have the following error

XMLHttpRequest cannot load https://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/1.0.1/stacktrace.min.js.map. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:1841' is therefore not allowed access.

I also try to include all the source but it try to load some ressources when i load my page and I don't understand how to change the location...

Anyhow I don't understand how to properly include this lib in my app in Sencha Cmd properly way...

Thanks in advance

Psycho
  • 381
  • 1
  • 17

1 Answers1

0

Regarding this error:

XMLHttpRequest cannot load https://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/1.0.1/stacktrace.min.js.map...

Note that this is for the source map file and should not affect the libraries effectiveness.

I hope you can verify that stacktrace.min.js loaded in the Network tab of your browser console. If so, then perhaps you can try a simple example from the docs and see if you get a stacktrace or an Error.

If you do get an Error, please post here a little bit more of your code and what you see in your browser console and I'll be happy to help further.

Eric Wendelin
  • 43,147
  • 9
  • 68
  • 92
  • The tag is in my page (StackTrace, Stackframe [...] javascript objet are available). If I execute the first example: "Get a stack trace from current location", i get in the _console_ : `XMLHttpRequest cannot load https://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/1.0.1/stacktrace.min.js.map. No 'Access-Control-Allow-Origin' [...] is therefore not allowed access.` then the stacktrace (which seems to be correct). And more problematic in the _network tab_, I get a call to _stacktrace.min.js, 1 to _stacktrace.min.js.map_ and 4 to the current page! (which cause some unwanted load) – Psycho Jan 26 '16 at 08:38
  • 1
    stacktrace.js is trying to guess anonymous function names and is getting the source of the page to do so. You can call StackTrace.get({offline: true}) in order to avoid all network requests. – Eric Wendelin Jan 27 '16 at 03:25
  • It seems now that stacktrace-gps.min.js is doing the same think. If think the options passed to the ``get`` method are not forward to stracktrace-gps (I see the option is available in StrackTraceGps but I cannot set it to true as I didn't call it directly). – Psycho Jan 27 '16 at 08:45
  • Hm... that is a bug if that is true. I'm afraid I can't reproduce it, however. Would you consider attaching a more complete example and submitting it to the project? https://github.com/stacktracejs/stacktrace.js/issues – Eric Wendelin Jan 28 '16 at 04:07
  • I try to build an exemple with ``codepne.io`` and it works as expected :(. But double check on my case and I style have some loading from stracktrace-gps.min.js... I did not get it. I include the file exactly the same way, via the CDN... Didn't catch the dam think which make the think wrong... – Psycho Jan 28 '16 at 15:00