[Maps] Always initialize routes on server-startup#84806
[Maps] Always initialize routes on server-startup#84806thomasneirynck merged 4 commits intoelastic:masterfrom
Conversation
| const enterprise = license.check(APP_ID, 'enterprise'); | ||
| isEnterprisePlus = enterprise.state === 'valid'; | ||
|
|
||
| if (basic.state === 'valid' && !routesInitialized) { |
There was a problem hiding this comment.
checking for validity is not necessary. Other plugins do not check license-validity before registering the routes.
There was a problem hiding this comment.
Might be carryover from legacy patterns? Thanks for the clean up
|
Pinging @elastic/kibana-gis (Team:Geo) |
| } | ||
|
|
||
| lastLicenseId = currentLicenseId; | ||
| if (emsSettings.isIncludeElasticMapsService()) { |
There was a problem hiding this comment.
Should this include a check for lastLicenseId being undefined? What happens if getLicenseId returns undefined?
There was a problem hiding this comment.
EMS has a license validation on the backend as well. This will fallback to as-if OSS EMS would be used.
kindsun
left a comment
There was a problem hiding this comment.
Thanks so much for fixing! 🙇 Changes make sense and works as expected with ssl enabled
- code review
- tested locally in chrome
nreese
left a comment
There was a problem hiding this comment.
Thanks for digging into this problem and fixing.
LGTM
code review
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
* master: (40 commits) fix: 🐛 don't add separator befor group on no main items (elastic#83166) [Security Solution][Detections] Implements indicator match rule cypress test (elastic#84323) [APM] Add APM agent config options (elastic#84678) Fixed a11y issue on rollup jobs table selection (elastic#84567) [Discover] Refactor getContextUrl to separate file (elastic#84503) [Embeddable] Export CSV action for Lens embeddables in dashboard (elastic#83654) [TSVB] [Cleanup] Remove extra dateFormat props (elastic#84749) [Lens] Migrate legacy es client and remove total hits as int (elastic#84340) Improve logging pipeline in @kbn/legacy-logging (elastic#84629) Catch @hapi/podium errors (elastic#84575) [Discover] Unskip date histogram test (elastic#84727) Rename server.xsrf.whitelist to server.xsrf.allowlist (elastic#84791) [Enterprise Search] Fix schema errors button (elastic#84842) [APM] Removes react-sticky dependency in favor of using CSS (elastic#84589) [Maps] Always initialize routes on server-startup (elastic#84806) [Fleet] EPM support to handle uploaded file paths (elastic#84708) [Snapshot Restore] Fix initial policy form state (elastic#83928) Upgrade Node.js to version 14 (elastic#83425) [Security Solution] Keep Endpoint policies up to date with license changes (elastic#83992) [Security Solution][Exceptions] Implement exceptions for ML rules (elastic#84006) ...
* master: (236 commits) fix: 🐛 don't add separator befor group on no main items (elastic#83166) [Security Solution][Detections] Implements indicator match rule cypress test (elastic#84323) [APM] Add APM agent config options (elastic#84678) Fixed a11y issue on rollup jobs table selection (elastic#84567) [Discover] Refactor getContextUrl to separate file (elastic#84503) [Embeddable] Export CSV action for Lens embeddables in dashboard (elastic#83654) [TSVB] [Cleanup] Remove extra dateFormat props (elastic#84749) [Lens] Migrate legacy es client and remove total hits as int (elastic#84340) Improve logging pipeline in @kbn/legacy-logging (elastic#84629) Catch @hapi/podium errors (elastic#84575) [Discover] Unskip date histogram test (elastic#84727) Rename server.xsrf.whitelist to server.xsrf.allowlist (elastic#84791) [Enterprise Search] Fix schema errors button (elastic#84842) [APM] Removes react-sticky dependency in favor of using CSS (elastic#84589) [Maps] Always initialize routes on server-startup (elastic#84806) [Fleet] EPM support to handle uploaded file paths (elastic#84708) [Snapshot Restore] Fix initial policy form state (elastic#83928) Upgrade Node.js to version 14 (elastic#83425) [Security Solution] Keep Endpoint policies up to date with license changes (elastic#83992) [Security Solution][Exceptions] Implement exceptions for ML rules (elastic#84006) ...
…overy-action-group * upstream/master: (48 commits) [Lens] accessibility screen reader issues (elastic#84395) [Logs UI] Fetch single log entries via a search strategy (elastic#81710) fix: 🐛 don't add separator befor group on no main items (elastic#83166) [Security Solution][Detections] Implements indicator match rule cypress test (elastic#84323) [APM] Add APM agent config options (elastic#84678) Fixed a11y issue on rollup jobs table selection (elastic#84567) [Discover] Refactor getContextUrl to separate file (elastic#84503) [Embeddable] Export CSV action for Lens embeddables in dashboard (elastic#83654) [TSVB] [Cleanup] Remove extra dateFormat props (elastic#84749) [Lens] Migrate legacy es client and remove total hits as int (elastic#84340) Improve logging pipeline in @kbn/legacy-logging (elastic#84629) Catch @hapi/podium errors (elastic#84575) [Discover] Unskip date histogram test (elastic#84727) Rename server.xsrf.whitelist to server.xsrf.allowlist (elastic#84791) [Enterprise Search] Fix schema errors button (elastic#84842) [APM] Removes react-sticky dependency in favor of using CSS (elastic#84589) [Maps] Always initialize routes on server-startup (elastic#84806) [Fleet] EPM support to handle uploaded file paths (elastic#84708) [Snapshot Restore] Fix initial policy form state (elastic#83928) Upgrade Node.js to version 14 (elastic#83425) ...
Summary
Closes #84718
Routes would be initialized only on the first subscription-event from the license-observable. A subscribe-event on an Observable provides no guarantees this will fire after startup of the Maps plugin.
The reason route-init was delayed until license-information became available was because the
EMSClient-library needs a license-id.In certain scenarios, routes would not get initialized, causing 404s when Maps attempts to make a backend call.
This would manifest in the Maps-app in subtle ways. Starting in ssl-mode would be especially sensitive to this issue
Solution:
Routes will always get initialized on plugin startup. This PR adds a callback to retrieve the license-id for the EMSClient.
A minor bonus of this change is that the license-changes will cause the EMSClient to be recreated. This only applies to the proxying of EMS-request, and this feature will be deprecated in 8.0 regardless (#82132), so impact of this is minor.
For maintainers