What is 'Script Error'?

Script Error, ugh 🤮

Noibu's goal is to detect all errors that occur on your website and as a result we capture errors with varying amounts of information about them. The most common example of errors that contain little information are called "Script Errors". Script Errors are identifiable via their unique error signature which will always contain script error as the first two words.

 

Screen_Shot_2021-02-16_at_2.55.19_PM.png

Script Errors happen when an error originating from a third party plugin/file/add-on throws an error on your domain. Since modern browsers block information from domains other than yours from being shared with scripts and code that lives on your domain, our script cannot pick up the unique information of those errors. Rather, our script simply gets the information that an error occurred and is thus labelled as script error. 

 

To help reduce the amount of script errors that are caught by Noibu, we automatically wrap your existing front end code with our code to try to extract as much information possible. For the script errors that do pass by our wrapping, we do our best to separate script errors from each other to offer you more error coverage.

 

How To uncover Script Errors?🕵️‍♀️

Noibu automatically wraps all necessary code to try to extract as many errors as possible from your code, but even that is sometimes not enough.

 

Since the root cause of script errors is cross origin request blocking you can change the way you fetch certain scripts from their respective servers in order to avoid cross origin checking. 

 

Step 1: change the script tag in your html

Imagine you had this script in you html code

<script src="http://not-your-domain.com/app.js"></script>

You would then change it to be

<script src="http://not-your-domain.com/app.js" crossorigin="anonymous"></script>

Which tells the server to anonymously fetch the script url, which in turn will enable Noibu to get access to more information about the error. This does not impact any functionality of the script.

 

 

Step 2: Add Cross Origin Headers (only possible if you have access to the server)

Note: Most public urls such as Google's gtm already have this setting enabled. Feel free to ask us if a certain server has these headers and we will check for you.

 

Now this step is dependent on the flavour of your backend, the implementation steps are different for each backend type. The gist of the step is to send back the following header when the script is being requested from the client side.

Access-Control-Allow-Origin: *

 

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.