# SDK Load Failure: Troubleshooting steps ## CDN Blocked This situation is possible when an Application Insights JS SDK CDN endpoint has been reported and/or identified as being unsafe for some reason. When this occurs, it will cause the endpoint to be publicly block-listed and consumers of these lists will begin to block all access. Resolving this requires the owner of the CDN endpoint to work with the block-listing entity that has marked the endpoint as unsafe so that it can be removed from the relevant list. Check if the CDN endpoint has been identified as unsafe. - [Google Transparency Report](https://transparencyreport.google.com/safe-browsing/search) - [VirusTotal](https://www.virustotal.com/gui/home/url) - [Sucuri SiteCheck](https://sitecheck.sucuri.net/) Depending on the frequency that the application, firewall or environment update their local copies of these lists, it may take a considerable amount of time and/or require manual intervention by end users or corporate IT departments to force an update or explicitly allow the CDN endpoints to resolve the issue. If the CDN endpoint is identified as unsafe, please [create a support ticket](#create-a-support-ticket) with the required details to ensure that the issue is resolved as soon as possible. You may also want to consider [changing the SDK CDN endpoint](#change-the-cdn-endpoint) to _potentially_ bypass this issue more rapidly. ## Intermittent Network Failure If the user is experiencing intermittent network connectivity failures, then there are fewer possible solutions and they will generally resolve themselves over a short period of time. For example, if the user reloads your site the files will (eventually) get downloaded and cached locally until an updated version is released. With this situation [Hosting the SDK on you own CDN](#host-sdk) is unlikely to provide or reduce the occurrences of this exception, as your own CDN will be affected by the same issue. The same is also true when [using the SDK via NPM packages](#use-npm) solution, however, from the end users perspective when this occurs your entire application fails to load / initialize (rather than _just_ the telemetry SDK - which they don't see visually), so they will most likely refresh your site until is loads completely. ## Add Exceptions for CDN endpoints Work with your end users or provide documentation informing them that they should allow scripts from the Application Insights CDN endpoints to be downloaded by including them in their browsers plug-in or firewall rule exception list, this will vary based on the end users environment. Here is an example of how to configure within [Chrome to allow or block access to websites](https://support.google.com/chrome/a/answer/7532419?hl=en) ## Corporate Exceptions for CDN endpoints This is similar to [adding exceptions for end users](#add-exceptions-for-cdn-endpoints), but you will need to work with your end users IT department to have them configure the Application Insights CDN endpoints to be downloaded by including (or removing) them in any domain block-listing or allow-listing services. > :warning: **Important** > > If the your corporate user is using a [private cloud](https://azure.microsoft.com/overview/what-is-a-private-cloud/) and they cannot enable any form of exception to provide their internal users with public access for the CDN endpoints then you will need to [use the NPM packages](#use-npm) or [host the Application Insights SDK on your own CDN](#host-sdk). ## Change the CDN endpoint As the snippet and its configuration are returned by your application as part of each generated page, you can change the snippet `src` configuration to use a different URL for the SDK. By using this approach, you could bypass the [CDN Blocked](#cdn-blocked) issue as the new URL should not be blocked. Current Application Insights JavaScript SDK CDN endpoints - ~~https://az416426.vo.msecnd.net/scripts/b/ai.2.min.js~~ - https://js.monitor.azure.com/scripts/b/ai.3.gbl.min.js (for snippet version >=7) - https://js.monitor.azure.com/scripts/b/ai.2.min.js (for snippet version <7) > :bulb: **Note** > > The https://js.monitor.azure.com/ endpoint is an alias that allows us to switch between CDN providers within approximately 5 minutes, without the need for you to change any config. This is to enable us to fix detected CDN related issues more rapidly if a CDN provider is having regional or global issues without requiring everyone to adjust their settings. ## Use NPM Rather than using the snippet and public CDN endpoints you could use the NPM packages to include the SDK as part of your own JavaScript files. With this approach, the SDK will become just another package within your own scripts. Note: It is recommended that when using this approach, you should also use some form of [JavaScript bundler](https://www.bing.com/search?q=javascript+bundler) to assist with code splitting and minification. As with the snippet, it is also possible that your own scripts (with or without using the SDK NPM packages) could be affected by the same blocking issues listed here, so depending on your application, your users, and your framework you may want to consider implementing something similar to logic in the snippet to detect and report these issues. > :bulb: **Note** > > You will need to use this approach (or [Host the SDK on you own CDN](#host-sdk)) if your users are using a [private cloud](https://azure.microsoft.com/overview/what-is-a-private-cloud/) as they most likely will not have access to the public internet. ## Host SDK Rather than your end users downloading the Application Insights SDK from the public CDN you could host the Application Insights SDK from your own CDN endpoint. If using this approach, it is recommended that you use a specific version (ai.3.gbl.#.#.min.js) so that it's easier to identify which version you are using, it is also recommended that update it on a regular basis to the current version (ai.3.gbl.min.js) so you can leverage any bug fixes and new features that become available.