I could verify the centos7-katello-nightly
box is broken, once you open it you will see a javascript error in the login page while the page is still functioning:
katello:fills-ccdbc5a5bf8461855f61.js:1 Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "react-component" has already been used with this registry
at Object../webpack/assets/javascripts/react_app/common/MountingService.js (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/katello/katello:fills-ccdbc5a5bf8461855f61.js:1:27287)
at o (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/vendor-4f7f4f3563d146a3e24d.js:1:411)
at Object.../../../../../BUILDROOT/tfm-rubygem-katello-3.15.0-0.4.pre.master.20200119210854git796b07d.el7.noarch/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.15.0.pre.master/webpack/fills_index.js (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/katello/katello:fills-ccdbc5a5bf8461855f61.js:1:6343)
at o (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/vendor-4f7f4f3563d146a3e24d.js:1:411)
at window.webpackJsonp (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/vendor-4f7f4f3563d146a3e24d.js:1:284)
at https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/katello/katello:fills-ccdbc5a5bf8461855f61.js:1:1
When I navigate to /foreman_tasks/tasks
I receive a blank page with more JS errors:
foreman-tasks-8f031ef96597f7cc6551.js:1 Uncaught TypeError: (0 , i.translate) is not a function
at Object../webpack/assets/javascripts/react_app/components/common/charts/LineChart/index.js (foreman-tasks-8f031ef96597f7cc6551.js:1)
at o (bootstrap 860ad639982f0cf45c34:54)
at Object../webpack/assets/javascripts/react_app/components/componentRegistry.js (foreman-tasks-8f031ef96597f7cc6551.js:1)
at o (bootstrap 860ad639982f0cf45c34:54)
at Object.../../../../../BUILDROOT/tfm-rubygem-foreman-tasks-0.17.3-1.fm1_25.el7.noarch/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.17.3/webpack/index.js (foreman-tasks-8f031ef96597f7cc6551.js:1)
at o (bootstrap 860ad639982f0cf45c34:54)
at window.webpackJsonp (bootstrap 860ad639982f0cf45c34:25)
at foreman-tasks-8f031ef96597f7cc6551.js:1
./webpack/assets/javascripts/react_app/components/common/charts/LineChart/index.js @ foreman-tasks-8f031ef96597f7cc6551.js:1
o @ bootstrap 860ad639982f0cf45c34:54
./webpack/assets/javascripts/react_app/components/componentRegistry.js @ foreman-tasks-8f031ef96597f7cc6551.js:1
o @ bootstrap 860ad639982f0cf45c34:54
../../../../../BUILDROOT/tfm-rubygem-foreman-tasks-0.17.3-1.fm1_25.el7.noarch/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.17.3/webpack/index.js @ foreman-tasks-8f031ef96597f7cc6551.js:1
o @ bootstrap 860ad639982f0cf45c34:54
window.webpackJsonp @ bootstrap 860ad639982f0cf45c34:25
(anonymous) @ foreman-tasks-8f031ef96597f7cc6551.js:1
componentRegistry.js:60 Uncaught Error: Component not found: ForemanTasks among ReactApp, SearchBar, AutoComplete, DonutChart, LineChart, StatisticsChartsList, PowerStatus, NotificationContainer, ToastNotifications, StorageContainer, PasswordStrength, BreadcrumbBar, FactChart, Pagination, Layout, EmptyState, BarChart, ChartBox, ComponentWrapper, ConfigReports, DiffModal, TemplateInput, ExternalLogout, Slot, RelativeDateTime, LongDateTime, ShortDateTime, IsoDate, FormField, InputFactory, ModelsTable, Editor, TemplateGenerator, LoginPage
at Object.getComponent (componentRegistry.js:60)
at Object.markup (componentRegistry.js:94)
at Pi (MountingService.js:22)
at Object.Si (MountingService.js:11)
at tasks:75
getComponent @ componentRegistry.js:60
markup @ componentRegistry.js:94
Pi @ MountingService.js:22
Si @ MountingService.js:11
(anonymous) @ tasks:75
katello:fills-ccdbc5a5bf8461855f61.js:1 Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "react-component" has already been used with this registry
at Object../webpack/assets/javascripts/react_app/common/MountingService.js (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/katello/katello:fills-ccdbc5a5bf8461855f61.js:1:27287)
at o (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/vendor-4f7f4f3563d146a3e24d.js:1:411)
at Object.../../../../../BUILDROOT/tfm-rubygem-katello-3.15.0-0.4.pre.master.20200119210854git796b07d.el7.noarch/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.15.0.pre.master/webpack/fills_index.js (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/katello/katello:fills-ccdbc5a5bf8461855f61.js:1:6343)
at o (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/vendor-4f7f4f3563d146a3e24d.js:1:411)
at window.webpackJsonp (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/vendor-4f7f4f3563d146a3e24d.js:1:284)
at https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/katello/katello:fills-ccdbc5a5bf8461855f61.js:1:1
Navigating to /subscriptions
giving a similar result with a blank page and the JS errors:
katello-717267ff57e4a17eb947.js:1 Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "react-component" has already been used with this registry
at Object../webpack/assets/javascripts/react_app/common/MountingService.js (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/katello/katello-717267ff57e4a17eb947.js:1:391569)
at o (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/vendor-4f7f4f3563d146a3e24d.js:1:411)
at Object.../../../../../BUILDROOT/tfm-rubygem-katello-3.15.0-0.4.pre.master.20200119210854git796b07d.el7.noarch/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.15.0.pre.master/webpack/index.js (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/katello/katello-717267ff57e4a17eb947.js:1:354686)
at o (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/vendor-4f7f4f3563d146a3e24d.js:1:411)
at window.webpackJsonp (https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/vendor-4f7f4f3563d146a3e24d.js:1:284)
at https://centos7-katello-nightly.sharvit-fedorabook-t480s.example.com/webpack/katello/katello-717267ff57e4a17eb947.js:1:1
./webpack/assets/javascripts/react_app/common/MountingService.js @ katello-717267ff57e4a17eb947.js:1
o @ bootstrap 860ad639982f0cf45c34:54
../../../../../BUILDROOT/tfm-rubygem-katello-3.15.0-0.4.pre.master.20200119210854git796b07d.el7.noarch/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.15.0.pre.master/webpack/index.js @ katello-717267ff57e4a17eb947.js:1
o @ bootstrap 860ad639982f0cf45c34:54
window.webpackJsonp @ bootstrap 860ad639982f0cf45c34:25
(anonymous) @ katello-717267ff57e4a17eb947.js:1
componentRegistry.js:60 Uncaught Error: Component not found: katello among ReactApp, SearchBar, AutoComplete, DonutChart, LineChart, StatisticsChartsList, PowerStatus, NotificationContainer, ToastNotifications, StorageContainer, PasswordStrength, BreadcrumbBar, FactChart, Pagination, Layout, EmptyState, BarChart, ChartBox, ComponentWrapper, ConfigReports, DiffModal, TemplateInput, ExternalLogout, Slot, RelativeDateTime, LongDateTime, ShortDateTime, IsoDate, FormField, InputFactory, ModelsTable, Editor, TemplateGenerator, LoginPage
at Object.getComponent (componentRegistry.js:60)
at Object.markup (componentRegistry.js:94)
at Pi (MountingService.js:22)
at Object.Si (MountingService.js:11)
at subscriptions:71
What does it mean?
Looking closer at the error: the name "react-component" has already been used with this registry
.
It happens because we are trying to define a new web-component called “react-component” but this web-component already defined before.
There is an issue with our build where the source code of the foreman/webpack/assets/javascripts/react_app/*
gets copied to each plugin bundle.
See: Bug #27195: Plugin stylesheet bundles contain styles from core - Foreman
We know about this issue for a long while but no one actually tried to fix it because:
- Somehow everything used to work well
- Nobody had the capacity or the willingness to fix that issue
- I suggested a long-term solution which includes redesigning the js-build
It is in a development process, see the discussion we had about that:
RFC: Changing how we handle Webpack Building
Webpacking plugins, let's do it right
Redesigning the javascript stack
I try to fix that issue in this PR but it wasn’t stable enough because of the usage of the webpack-common-chunk-plugin
, see: Fixes #27195 - react_app folder as a common chunk by sharvit · Pull Request #7320 · theforeman/foreman · GitHub
Trying to reproduce on a centos7-luna-devel
Unfortunately, I cannot reproduce this error in a devel box centos7-luna-devel
.
I tried running a development server
bundle exec foreman start
No Errors
I tried building production and running a production server:
RAILS_ENV=production bundle exec rake assets:precompile
RAILS_ENV=production bundle exec rake webpack:compile
RAILS_ENV=production bundle exec foreman start rails
No Errors
I tried to remove foreman/public/webpack/katello*
and build katello/public/webpack
:
rm -rf public/webpack/katello*
RAILS_ENV=production bundle exec rake plugin:assets:precompile[katello]
RAILS_ENV=production bundle exec foreman start rails
No Errors but when I navigate to /subscriptions
I get a blank page with a JS error:
react-dom.production.min.js:187 TypeError: Cannot read property 'canDeleteManifest' of undefined
at t.value (SubscriptionsPage.js:176)
at gi (react-dom.production.min.js:173)
at mi (react-dom.production.min.js:172)
at Gs (react-dom.production.min.js:247)
at Bs (react-dom.production.min.js:216)
at Ds (react-dom.production.min.js:210)
at Ns (react-dom.production.min.js:206)
at react-dom.production.min.js:114
at t.unstable_runWithPriority (scheduler.production.min.js:20)
at co (react-dom.production.min.js:113)
Ni @ react-dom.production.min.js:187
Ui.n.callback @ react-dom.production.min.js:200
Do @ react-dom.production.min.js:125
zo @ react-dom.production.min.js:125
(anonymous) @ react-dom.production.min.js:239
t.unstable_runWithPriority @ scheduler.production.min.js:20
co @ react-dom.production.min.js:113
$s @ react-dom.production.min.js:230
Ns @ react-dom.production.min.js:206
(anonymous) @ react-dom.production.min.js:114
t.unstable_runWithPriority @ scheduler.production.min.js:20
co @ react-dom.production.min.js:113
fo @ react-dom.production.min.js:114
po @ react-dom.production.min.js:113
As @ react-dom.production.min.js:204
enqueueSetState @ react-dom.production.min.js:127
w.setState @ react.production.min.js:13
(anonymous) @ i18nProviderWrapperFactory.js:19
Promise.then (async)
I18nProviderWrapper(Connect(Component)) @ i18nProviderWrapperFactory.js:18
Ho @ react-dom.production.min.js:129
mi @ react-dom.production.min.js:167
Gs @ react-dom.production.min.js:247
Bs @ react-dom.production.min.js:216
Ds @ react-dom.production.min.js:210
As @ react-dom.production.min.js:204
il @ react-dom.production.min.js:263
sl @ react-dom.production.min.js:263
(anonymous) @ react-dom.production.min.js:272
Is @ react-dom.production.min.js:208
fl @ react-dom.production.min.js:272
render @ react-dom.production.min.js:273
b @ MountingService.js:21
t.mount @ MountingService.js:11
(anonymous) @ subscriptions:71
SubscriptionsPage.js:176 Uncaught (in promise) TypeError: Cannot read property 'canDeleteManifest' of undefined
at t.value (SubscriptionsPage.js:176)
at gi (react-dom.production.min.js:173)
at mi (react-dom.production.min.js:172)
at Gs (react-dom.production.min.js:247)
at Bs (react-dom.production.min.js:216)
at Ds (react-dom.production.min.js:210)
at Ns (react-dom.production.min.js:206)
at react-dom.production.min.js:114
at t.unstable_runWithPriority (scheduler.production.min.js:20)
at co (react-dom.production.min.js:113)
At this point, I am very confused
I tried to remove foreman/public/webpack/foreman-tasks*
and build foreman-tasks/public/webpack
:
rm -rf public/webpack/foreman-tasks*
RAILS_ENV=production bundle exec rake plugin:assets:precompile[foreman-tasks]
RAILS_ENV=production bundle exec foreman start rails
Same like the previous, error when navigation to /subscriptions
Questions I still can’t answer
- Why now? It used to work before. AFAIK it used to work after we introduced the web-component.
- How to reproduce it in a devel machine?
I will keep updating here about the effort to fix it.