I'm trying to create a migrate PR here https://github.com/elastic/kibana/pull/34766 to see what's it looks like, here is a few issues I found
server/plugin.ts, the public stop(core: PluginStop) has wrong signaturepublic/plugin.ts and public/index.ts are totally wrongx-pack/plugins: https://github.com/elastic/kibana/pull/34766/files#diff-818ea503e65da33d3ecda21f8aaf2a1dR120core.testbed.secret when configured it in kibana.ymlPlugin discovery should support x-pack in the next couple days. It was intentionally omitted so far, but it's up next.
I believe that log line you linked would only fire if something actually subscribed to the exposed data$ observable.
I'm not sure why the core.testbed.secret config validation isn't working. That's definitely a bug, so we'll sort it out.
https://github.com/elastic/kibana/pull/34725 Fixes the signatures.
To add some additional comments to @zfy0701's comment, the config validation failed because of the error in here. The config is undefined while the upgrade() does not handle this case.

Also, the console throws out the right error when you add some print statements for debugging. However, without these print statements, the error won't be triggered, which is also weird.
Configuring logger failed: TypeError: Cannot read property 'appenders' of undefined
at LoggingService.appenders [as upgrade] (/Users/mengwei/kibana/src/core/server/logging/logging_service.ts:71:56)
at MapSubscriber.upgrade (/Users/mengwei/kibana/src/core/server/root/index.ts:96:29)
at MapSubscriber._next (/Users/mengwei/kibana/node_modules/rxjs/src/internal/operators/map.ts:81:29)
at MapSubscriber.Subscriber.next (/Users/mengwei/kibana/node_modules/rxjs/src/internal/Subscriber.ts:102:12)
at SwitchMapSubscriber.notifyNext (/Users/mengwei/kibana/node_modules/rxjs/src/internal/operators/switchMap.ts:141:24)
at InnerSubscriber._next (/Users/mengwei/kibana/node_modules/rxjs/src/internal/InnerSubscriber.ts:17:17)
at InnerSubscriber.Subscriber.next (/Users/mengwei/kibana/node_modules/rxjs/src/internal/Subscriber.ts:102:12)
at MapSubscriber._next (/Users/mengwei/kibana/node_modules/rxjs/src/internal/operators/map.ts:86:22)
at MapSubscriber.Subscriber.next (/Users/mengwei/kibana/node_modules/rxjs/src/internal/Subscriber.ts:102:12)
at DistinctUntilChangedSubscriber._next (/Users/mengwei/kibana/node_modules/rxjs/src/internal/operators/distinctUntilChanged.ts:121:24)
FATAL TypeError: Cannot read property 'appenders' of undefined
steps to reproduce:
core.testbed.secret: secret-value in kibana.yamlyarn startError: "core.testbed.secret" setting was not applied. Check for spelling errors and ensure that expected plugins are installed. This error happens on Optimizer server, where plugins.initialize:false, so New platform plugin don't run and don't read from config
I believe that log line you linked would only fire if something actually subscribed to the exposed data$ observable.
true. to check it works
public setup(setupContext: PluginSetupContext, deps: Record<PluginName, unknown>) {
this.log.debug(
`Setting up TestBed with core contract [${Object.keys(setupContext)}] and deps [${Object.keys(
deps
)}]`
);
const data$ = this.initializerContext.config.create(TestBedConfig).pipe(
map(config => {
this.log.debug(`I've got value from my config: ${config.secret}`);
return `Some exposed data derived from config: ${config.secret}`;
})
);
data$.subscribe(console.log);
return {
data$,
...
@mw-ding how can I reproduce the error on your screenshot? I tried to add an invalid property to logging config and start immediately failed
regarding https://github.com/elastic/kibana/issues/34812#issuecomment-482120979
New platform plugins are discovered in
Legacy platform plugins are discovered in
So Legacy platform doesn't know about New platform plugins status (initialized, disabled, run, etc.). I'd suggest excluding all config keys for New Platform plugins from this check https://github.com/elastic/kibana/blob/master/src/legacy/server/config/complete.js#L27
Because config keys are validated when New platform creates plugin config. If a plugin is disabled or not initialized it can be reported, but shouldn't prevent the server from running.
I talked to @azasypkin and he mentioned that we already have related issue to validate config upfront https://github.com/elastic/kibana/issues/20303
After discussion we decided to consider next refactoring:
Observable<validated schema> when created, instead of manually subscribing to config service@mw-ding how can I reproduce the error on your screenshot? I tried to add an invalid property to logging config and start immediately failed
Cannot reproduce the TypeError now. And yes, it immediately failed after providing an invalid property.