0

I have a set-up using templates from my CDN, that usually works fine but periodically I get this error:

ng-error: Error: [$sce:insecurl] http://errors.angularjs.org/1.7.5/$sce/insecurl?p0=https%3A%2F%2Fcomplicemail-herokuapp-com.global.ssl.fastly.net%2Fstatic%2Ftemplates%2Fviewschedule.a15ce4bf.html

I grepped the codebase for viewsched, and literally the only two places in the code where that template are my precache list in my service worker, and this line in the angularjs file:

$scope.scheduleTemplateUrl = $sce.trustAsResourceUrl('/templates/viewschedule.html')

Gulp turns that line into the one that references the CDN:

$scope.scheduleTemplateUrl = $sce.trustAsResourceUrl('https://complicemail-herokuapp-com.global.ssl.fastly.net/static/templates/viewschedule.a15ce4bf.html')

I know that part's working because the insecurl error shows the CDN url.

My first guess that the issue is something like "for whatever reason (eg shoddy internet) the browser couldn't connect with the CDN at that moment and failed to fetch the file, giving some sort of HTTP response code that AngularJS considers insecure. But I think that would produce this issue (which I also periodically get)

ng-error: Error: [$templateRequest:tpload] http://errors.angularjs.org/1.7.5/$templateRequest/tpload?p0=https%3A%2F%2Fcomplicemail-herokuapp-com.global.ssl.fastly.net%2Fstatic%2Ftemplates%2Ftimer%2Fuser-other.27734af8.html&p1=-1&p2=

Any ideas? Also interested in ideas for how to more gracefully handle the tpload error situation in cases like this where the url is correct but the internet just conked out at that moment.

MalcolmOcean
  • 2,807
  • 2
  • 29
  • 38
  • Hi, obviously the request was failed, right? Could you please check why this request failed using [Chrome dev tools](https://developers.google.com/web/tools/chrome-devtools/network/resource-loading?utm_source=dcc&utm_medium=redirect&utm_campaign=2016q3#network_panel_overview) . It'll give you some hint about it. – chinmayan Mar 27 '19 at 04:23
  • the errors are happening on user machines, not on mine; I just get an error log. but wouldn't the request failing cause the tpload issue, not insecurl? – MalcolmOcean Mar 30 '19 at 22:14

0 Answers0