Skip to content

Instantly share code, notes, and snippets.

@johnpmitsch
Last active September 16, 2019 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnpmitsch/4f264d600f51444371f4d99ffef77cf2 to your computer and use it in GitHub Desktop.
Save johnpmitsch/4f264d600f51444371f4d99ffef77cf2 to your computer and use it in GitHub Desktop.
Satellite ngReact JS error

Cloned Satellite 6.6 seeing this error on any bastion page:

Error: [$injector:modulerr] Failed to instantiate module Bastion.content-views.versions due to:
Error: [$injector:modulerr] Failed to instantiate module Bastion.errata due to:
Error: [$injector:modulerr] Failed to instantiate module Bastion.dates due to:
Error: [$injector:modulerr] Failed to instantiate module react due to:
Error: [$injector:nomod] Module 'react' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.5/$injector/nomod?p0=react

A theory:

  • We use the package ngReact to use the react date module in bastion/angular pages.
  • We do have this in the bower.json, but iiuc this is only used for tests, not the actual shipped javascript packages on the bastion side of things.
    • Its also in devDependencies, which doesn't make much sense, it should be a production package
  • We package up the copied over packages in this folder for bastion dependencies
    • ngReact is not present there.
  • However, ngReact is in our package.json file
    • I'm actually not sure why, I don't think the react side needs it, only angular
  • I think that the only reason this has been working is because ngReact is packaged up with webpack and somehow the angular code is always loading after the webpack code.
  • My theory is on the cloned machine, the angular code is loaded first and because ngReact is not present in it's dependencies, it errors.
  • I'm not sure why this is exposed only on a cloned machine, looking into that part more

found something else:

  • In the javascript files in the browser: https://example.com/webpack/katello/katello:common-f508d0d51cd87e7e9bbd.js is returning a 403 forbidden, this is the file that contains ngReact
  • This is the error in apache
==> /var/log/httpd/foreman-ssl_error_ssl.log <==
[Sun Sep 15 23:08:11.194287 2019] [core:error] [pid 17232] [client 192.168.121.1:52452] AH00037: Symbolic link not allowed or link target not accessible: /usr/share/foreman/public/webpack/katello
  • That symlink is pointing to an old katello gem version (katello-3.12.0.9) and the file doesn't exist
==> /var/log/httpd/foreman-ssl_access_ssl.log <==
192.168.121.1 - - [15/Sep/2019:23:08:11 +0000] "GET /webpack/katello/katello:common-f508d0d51cd87e7e9bbd.js HTTP/1.1" 403 256 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36"
:q
^C
[root@sat-6-6-qa-rhel7 assets]# ls -al /usr/share/foreman/public/webpack/katello
lrwxrwxrwx. 1 root root 84 Aug 19 15:41 /usr/share/foreman/public/webpack/katello ->  /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.12.0.9/public/webpack/katello

That folder is not on the machine

[root@sat-6-6-qa-rhel7 assets]# ls -al /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.12.0.9/public/webpack/katello
ls: cannot access /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.12.0.9/public/webpack/katello: No such file or directory

A newer gem is and it has katello:common JS file

[root@sat-6-6-qa-rhel7 assets]# ls -al /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.12.0.25/public/webpack/katello/
total 12076
drwxr-xr-x. 4 root root    4096 Sep 15 19:37 .
drwxr-xr-x. 3 root root      21 Sep 15 19:37 ..
-rw-r--r--. 1 root root   95380 Sep 13 17:20 bundle-468e7adeaf16003470e4.css
-rw-r--r--. 1 root root   18004 Sep 13 17:20 bundle-468e7adeaf16003470e4.css.gz
-rw-r--r--. 1 root root     116 Sep 13 17:20 bundle-468e7adeaf16003470e4.css.map
-rw-r--r--. 1 root root  417073 Sep 13 17:20 bundle-468e7adeaf16003470e4.js
-rw-r--r--. 1 root root   79425 Sep 13 17:20 bundle-468e7adeaf16003470e4.js.gz
-rw-r--r--. 1 root root  216860 Sep 13 17:20 bundle-468e7adeaf16003470e4.js.map.gz
drwxr-xr-x. 3 root root      20 Sep 15 19:37 intl
-rw-r--r--. 1 root root   40745 Sep 13 17:20 katello-b4b07e889587dc9d517a.css
-rw-r--r--. 1 root root    7477 Sep 13 17:20 katello-b4b07e889587dc9d517a.css.gz
-rw-r--r--. 1 root root     117 Sep 13 17:20 katello-b4b07e889587dc9d517a.css.map
-rw-r--r--. 1 root root  802982 Sep 13 17:20 katello-b4b07e889587dc9d517a.js
-rw-r--r--. 1 root root  141832 Sep 13 17:20 katello-b4b07e889587dc9d517a.js.gz
-rw-r--r--. 1 root root  385665 Sep 13 17:20 katello-b4b07e889587dc9d517a.js.map.gz
-rw-r--r--. 1 root root  168528 Sep 13 17:20 katello:common-f508d0d51cd87e7e9bbd.js
-rw-r--r--. 1 root root   58604 Sep 13 17:20 katello:common-f508d0d51cd87e7e9bbd.js.gz
-rw-r--r--. 1 root root  369240 Sep 13 17:20 katello:common-f508d0d51cd87e7e9bbd.js.map.gz
-rw-r--r--. 1 root root    5746 Sep 13 17:20 manifest.json
-rw-r--r--. 1 root root    1032 Sep 13 17:20 manifest.json.gz
drwxr-xr-x. 3 root root      20 Sep 15 19:37 react-intl
-rw-r--r--. 1 root root 4769101 Sep 13 17:20 vendor-101d5503aa23ed08e8bc.js
-rw-r--r--. 1 root root 1399650 Sep 13 17:20 vendor-101d5503aa23ed08e8bc.js.gz
-rw-r--r--. 1 root root 3337142 Sep 13 17:20 vendor-101d5503aa23ed08e8bc.js.map.gz

I'm not sure why this is the only file that errors, the rest in that directory load fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment