-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NP apps with custom appRoute
fail to load due to missing legacy injected vars
#54470
Comments
Pinging @elastic/kibana-platform (Team:Platform) |
So. The actual error cause is that when rendering a NP app, the
in the ui_render_mixin this is done using legacy API: kibana/src/legacy/ui/ui_render/ui_render_mixin.js Lines 185 to 193 in 357be59
But when rendering NP app, it seems there is no way to actually provide these vars to the rendering service. However the kibana/src/plugins/newsfeed/public/plugin.tsx Lines 55 to 59 in a50dbef
I thought we had functional tests covering this, but TIL they are only checking the response status, missing any actual error when displaying the page... kibana/test/api_integration/apis/core/index.js Lines 37 to 40 in 054ec70
It seems we need a way to retrieve the legacy vars the same way @eliperelman @joshdover will need your insight on this one. |
Also, as already mentioned with @azasypkin on slack, I think we should really provide an helper API to avoid plugins manually registering their custom route path handler on every app using an Instead of router.get(
{
path: '/my-app-route',
validate: false,
},
async (context, req, res) => {
// + additional parameters for vars it seems
const body = await context.core.rendering.render({ includeUserSettings: false });
return res.ok({
body,
headers: {
'content-security-policy': core.http.csp.header,
},
});
}
); should we just add something like core.http.registerCustomAppRoute('/my-app-route', { includeUserSettings, requireAuth }) As it seems 99% (maybe 100%?) of the usages will be the exact same code snippet, that we could automate inside core. Also for futur-us: there is a typo in the security header that needs to be fixed for FT when we will add them: kibana/src/plugins/testbed/server/index.ts Lines 95 to 101 in 56041f0
|
appRoute
fail to load due to missing legacy injected varsappRoute
fail to load due to missing legacy injected vars
Also related to #54376 |
I think there's two options here:
(1) is seems much more preferable as it's work that needs to be done anyways, and we won't throw any of it away like we would with the work required for (2). |
I would like to think option 1 is the way to go, however the feature is currently broken, and going this path makes us depends on feature teams changes. I we decide to do this, would we handle the migration of For the newsfeed plugin, the migration is pretty trivial, just need to replace the exposed var to the new |
Chromeless apps with custom
appRoute
fail to load because of missing legacy injected vars required by non-related new platform plugins.Steps to reproduce:
http://localhost:5601/some
in the browser.Expected behavior:
View should load successfully.
Screenshots (if relevant):
Errors in browser console (if relevant):
Completely unrelated
Newsfeed
plugin causes fatal error due to missing injected var it depends on:/cc @eliperelman @legrego
The text was updated successfully, but these errors were encountered: