opensearch-project / security-dashboards-plugin

🔐 Manage your internal users, roles, access control, and audit logs from OpenSearch Dashboards
https://opensearch.org/docs/latest/security-plugin/index/
Apache License 2.0
68 stars 148 forks source link

[BUG] Create Roles Tab is crashing cypress #1885

Closed derek-ho closed 2 months ago

derek-ho commented 3 months ago

What is the bug? Create roles tab is crashing cypress.

From console, I am seeing the following errors originating from this tab, which may be related:

index-permission-panel.tsx:217 Warning: Cannot update a component (`RoleEdit`) while rendering a different component (`IndexPermissionPanel`). To locate the bad setState() call inside `IndexPermissionPanel`, follow the stack trace as described in https://fb.me/setstate-in-render
    in IndexPermissionPanel (created by RoleEdit)
    in RoleEdit (created by Context.Consumer)
    in Route (created by AppRouter)
    in Switch (created by AppRouter)
    in div (created by EuiPageBody)
    in EuiPageBody (created by AppRouter)
    in div (created by EuiPage)
    in EuiPage (created by AppRouter)
    in Router (created by HashRouter)
    in HashRouter (created by AppRouter)
    in AppRouter
    in PseudoLocaleWrapper (created by I18nProvider)
    in IntlProvider (created by I18nProvider)
    in I18nProvider
printWarning @ react-dom.development.js:88
error @ react-dom.development.js:60
warnAboutRenderPhaseUpdatesInDEV @ react-dom.development.js:23241
scheduleUpdateOnFiber @ react-dom.development.js:21165
dispatchAction @ react-dom.development.js:15660
IndexPermissionPanel @ index-permission-panel.tsx:217
renderWithHooks @ react-dom.development.js:14803
mountIndeterminateComponent @ react-dom.development.js:17482
beginWork @ react-dom.development.js:18596
beginWork$1 @ react-dom.development.js:23179
performUnitOfWork @ react-dom.development.js:22154
workLoopSync @ react-dom.development.js:22130
performSyncWorkOnRoot @ react-dom.development.js:21756
scheduleUpdateOnFiber @ react-dom.development.js:21188
updateContainer @ react-dom.development.js:24373
(anonymous) @ react-dom.development.js:24758
unbatchedUpdates @ react-dom.development.js:21903
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
renderApp @ configuration-app.tsx:29
mount @ plugin.ts:78
await in mount (async)
(anonymous) @ application_service.tsx:155
mount @ app_container.tsx:68
(anonymous) @ app_container.tsx:86
commitHookEffectListMount @ react-dom.development.js:19731
commitLifeCycles @ react-dom.development.js:19787
commitLayoutEffects @ react-dom.development.js:22803
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
commitRootImpl @ react-dom.development.js:22541
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
commitRoot @ react-dom.development.js:22381
finishSyncRender @ react-dom.development.js:21807
performSyncWorkOnRoot @ react-dom.development.js:21793
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
unbatchedUpdates @ react-dom.development.js:21909
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24757
render @ react-dom.development.js:24840
start @ rendering_service.tsx:53
start @ core_system.ts:281
await in start (async)
__osdBootstrap__ @ osd_bootstrap.ts:54
await in __osdBootstrap__ (async)
(anonymous) @ bootstrap.js:153
innerCb @ bootstrap.js:85
load (async)
loadScript @ bootstrap.js:75
(anonymous) @ bootstrap.js:94
load @ bootstrap.js:81
window.onload @ bootstrap.js:99
load (async)
(anonymous) @ bootstrap.js:42
Show 38 more frames
Show less
tenant-panel.tsx:102 Warning: Cannot update a component (`RoleEdit`) while rendering a different component (`TenantPanel`). To locate the bad setState() call inside `TenantPanel`, follow the stack trace as described in https://fb.me/setstate-in-render
    in TenantPanel (created by RoleEdit)
    in RoleEdit (created by Context.Consumer)
    in Route (created by AppRouter)
    in Switch (created by AppRouter)
    in div (created by EuiPageBody)
    in EuiPageBody (created by AppRouter)
    in div (created by EuiPage)
    in EuiPage (created by AppRouter)
    in Router (created by HashRouter)
    in HashRouter (created by AppRouter)
    in AppRouter
    in PseudoLocaleWrapper (created by I18nProvider)
    in IntlProvider (created by I18nProvider)
    in I18nProvider

How can one reproduce the bug? Steps to reproduce the behavior: Run a cypress test case which visits the create role tab. Cypress will crash

What is the expected behavior? Cypress doesn't crash when visiting create roles tab

What is your host/environment?

Do you have any screenshots? If applicable, add screenshots to help explain your problem.

Do you have any additional context? Add any other context about the problem.

scrawfor99 commented 3 months ago

[Triage] Hi @derek-ho, thanks for filing this issue. Sounds like a good thing to check to make sure there are no problems with the infrastructure.

derek-ho commented 2 months ago

This was semi-addressed via re-running the cypress test. I also added a fix for this overall in the same PR. Closing the issue