nathangrove / ng-snow

Angular2+ starter application for ServiceNow integration
25 stars 23 forks source link

Console 404 errors and multiple script includes? #1

Closed krisklosterman closed 6 years ago

krisklosterman commented 7 years ago

Cloned the project, followed the setup guide and deployed.

Here is the element display in the browser,

<body><div style="display:none"></div><meta charset="utf-8"><title>ng2snow</title><script>//  
(function() { window['_app_base'] = window.location.pathname;window['_g_ck']="50092b534f213200cf843ce18110c7d8b6d3e2474bd98179f4bf566c7dfe9dfa22fa230e";})()
//</script><link rel="stylesheet" crossorigin="anonymous" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" type="text/css" href="2f7927134f213200cf843ce18110c72e.cssdbx"><link rel="icon" type="image/x-icon" href="favicon.ico"><link rel="stylesheet" href="styles.d41d8cd98f00b204e980.bundle.css"><app-root ng-version="2.4.10" _nghost-gby-0=""><div _ngcontent-gby-0="" class="col-md-8 col-md-offset-2">

  <div _ngcontent-gby-0="" class="panel panel-default">
    <div _ngcontent-gby-0="" class="panel-heading"><h1 _ngcontent-gby-0="">ng2snow</h1></div>
    <div _ngcontent-gby-0="" class="panel-body">
      <router-outlet _ngcontent-gby-0=""></router-outlet><app-home _nghost-gby-2=""><p _ngcontent-gby-2="">
  home works!
</p>
</app-home>
    </div>
  </div>

</div>
</app-root><script type="text/javascript" src="inline.95e3ba953543f757b2f4.bundle.js">//  

//</script><script type="text/javascript" src="polyfills.b3d20eccae1f7f131691.bundle.js">//  

//</script><script type="text/javascript" src="vendor.a833722faa78d66043c1.bundle.js">//  

//</script><script type="text/javascript" src="main.1a74a8b6431e35ba96e6.bundle.js">//  

//</script><script type="text/javascript" src="/x_38543_global.inline.jsdbx?v=11-08-2016_1607&amp;c=4_51"></script><script type="text/javascript" src="/x_38543_global.polyfills.jsdbx?v=11-08-2016_1607&amp;c=4_51"></script><script type="text/javascript" src="/x_38543_global.vendor.jsdbx?v=11-08-2016_1607&amp;c=4_51"></script><script type="text/javascript" src="/x_38543_global.main.jsdbx?v=11-08-2016_1607&amp;c=4_51"></script><script></script></body>

Here is the console log errors

x_38543_global_index.do:5 GET https://dev15663.service-now.com/polyfills.b3d20eccae1f7f131691.bundle.js 
x_38543_global_index.do:3 GET https://dev15663.service-now.com/inline.95e3ba953543f757b2f4.bundle.js 
x_38543_global_index.do:7 GET https://dev15663.service-now.com/vendor.a833722faa78d66043c1.bundle.js 
x_38543_global_index.do:3 GET https://dev15663.service-now.com/styles.d41d8cd98f00b204e980.bundle.css 
x_38543_global_index.do:9 GET https://dev15663.service-now.com/main.1a74a8b6431e35ba96e6.bundle.js 
x_38543_global_index.do:7 GET https://dev15663.service-now.com/polyfills.b3d20eccae1f7f131691.bundle.js 
x_38543_global_index.do:9 GET https://dev15663.service-now.com/vendor.a833722faa78d66043c1.bundle.js 
x_38543_global_index.do:11 GET https://dev15663.service-now.com/main.1a74a8b6431e35ba96e6.bundle.js 404 (Not Found)

It potentially still works cause I get the Home Works!

nathangrove commented 7 years ago

This is a known problem. When it is running locally (or on a prod server), the server will serve the files from the relative root, however when it is deployed to ServiceNow, it uses jelly to include the scripts. Either way, the scripts are included, but it does provide annoying errors in the console for the 404s.

A potential solution would be detecting the deployment architecture and removing the script tags when in ServiceNow or adding the script tags when not in ServiceNow. I have to admit, I haven't looked too deep into solving the problem. It hasn't been a show stopper for me. This is something that will need to be cleaned up in the future though.

Thanks.

chrisj-au commented 6 years ago

edit Manually created UI script and added the content from the missing file which has worked around the issue. Would be good to find out why it's not uploading as there is very limited angular2+ servicenow resource online.


Appears to be a show stopper for me.

Uploading: index.html Upload failed with status code 404 for file: runtime.a66f828dca56eeb90e02.js Done uploading file index.html Done uploading file styles.a474c4b2064489e33e1b.css Done uploading file polyfills.44f857a85bdba65a6ab3.js Done uploading file main.acbc327af5c9c799a493.js

Error loading the page (obfuscated the numbers): x_00000_ccw000.runtime.jsdbx:1 Failed to load resource: the server responded with a status of 404 (Not Found)

krisklosterman commented 6 years ago

@chrisjau I am not sure this code has been looked at in a while.

What version of Angular are you using.

I will play around with the latest version cause I think its been a while since i've tested this my self.

nathangrove commented 6 years ago

I've created a new issue to track this: #8

This is different than the 404s appearing in the browser's console. Let's move discussion over to there.

nathangrove commented 6 years ago

This original issue of 404s in the console has been resolved in the latest release 1.2.0 that I just officially released this morning because I'm a terrible repo owner and forgot to release it when I committed the fix.