Skip to content
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

[Serverless-observability-CDN-QA] Adding elasticsearch documents on Maps keeps loading layers infinitely #179058

Closed
bhavyarm opened this issue Mar 20, 2024 · 8 comments · Fixed by #179154
Labels
bug Fixes for quality problems that affect the customer experience Feature:Maps Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@bhavyarm
Copy link
Contributor

Kibana version: Kibana version: Serverless observability project testing for CDN readiness

Browser version: chrome latest

Describe the bug: I tried to add Kibana_sample_ecommerce documents to flights map. The layer keeps trying to load and there is failed to parse URL from internal/maps/getTile error in browser console.

Steps to reproduce:

  1. Add all sample data
  2. Open visualizations
  3. Click on flights map and then add layer ->elasticsearch documents and try to add kibana_sample_ecommerce data
cannot_load_layer.mp4
ncaught TypeError: Failed to construct 'Request': Failed to parse URL from /internal/maps/mvt/getTile/4/1/5.pbf?geometryFieldName=geoip.location&index=kibana_sample_data_ecommerce&hasLabels=false&buffer=0&requestBody=%28fields%3A%21%28%29%2Cquery%3A%28bool%3A%28filter%3A%21%28%28range%3A%28order_date%3A%28format%3Astrict_date_optional_time%2Cgte%3A%272024-03-13T04%3A00%3A00.000Z%27%2Clte%3A%272024-03-20T14%3A33%3A24.634Z%27%29%29%29%2C%28exists%3A%28field%3Ageoip.location%29%29%29%2Cmust%3A%21%28%29%2Cmust_not%3A%21%28%29%2Cshould%3A%21%28%29%29%29%2Cruntime_mappings%3A%28%29%2Csize%3A10000%29&token=96da2f9b-a6c8-444e-b69e-d48fef094f71&executionContextId=5dd88580-1906-11e9-919b-ffe5949a18d2
    at Nr (c86dfb7f678440f25f72f0dd4ba5dd0d.js:1:112894)
    at Zr (c86dfb7f678440f25f72f0dd4ba5dd0d.js:1:113933)
    at c86dfb7f678440f25f72f0dd4ba5dd0d.js:1:295416
    at Ru.Ju [as loadVectorData] (c86dfb7f678440f25f72f0dd4ba5dd0d.js:1:295448)
    at Ru.loadTile (c86dfb7f678440f25f72f0dd4ba5dd0d.js:1:295916)
    at ch.loadTile (c86dfb7f678440f25f72f0dd4ba5dd0d.js:1:328608)
    at Hr.processTask (c86dfb7f678440f25f72f0dd4ba5dd0d.js:1:119661)
    at Hr.process (c86dfb7f678440f25f72f0dd4ba5dd0d.js:1:119199)
    at Yr.MessageChannel._channel.port2.onmessage (c86dfb7f678440f25f72f0dd4ba5dd0d.js:1:117760)
@bhavyarm bhavyarm added bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Maps labels Mar 20, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@bhavyarm
Copy link
Contributor Author

cc @jloleysens @jsanz

@bhavyarm bhavyarm changed the title [Serverless-observability-CDN-QA] Adding elasticsearch documents on Maps keeps loading layers [Serverless-observability-CDN-QA] Adding elasticsearch documents on Maps keeps loading layers infinitely Mar 20, 2024
@jsanz
Copy link
Member

jsanz commented Mar 20, 2024

This happens with all vector tile resources.

As a temporary workaround, you can finish loading the layer and change the Scaling setting to the third option, Limit results to 10.000, to avoid loading vector tiles.

@jloleysens
Copy link
Contributor

jloleysens commented Mar 20, 2024

@jsanz @bhavyarm Not sure this is a CDN related issue, might be missing something though?

@jsanz
Copy link
Member

jsanz commented Mar 20, 2024

I can't reproduce this issue in a local development environment on main. Both, standard and serverless modes work as expected. I also checked the code at #178669, just in case, and it is all good as well.

@nickpeihl, do you know why the getTile endpoint may crash that way? We had another issue in that area, but it seems unrelated to this problem.

Since this really does not seem related to the CDN change, we may just try to reproduce it in our regular environments @bhavyarm

@nickpeihl
Copy link
Member

@nickpeihl, do you know why the getTile endpoint may crash that way? We had #177899 in that area, but it seems unrelated to this problem.

Forgive my ignorance, but do the CDN or CSP changes restrict mimetypes in any way? Vector tiles are returned as Content-Type: application/x-protobuf not application/json.

@jloleysens
Copy link
Contributor

Hey @nickpeihl ! It restricts what "interfaces" can be used to reach certain domains. For example <img src=".."> is one and JS fetch is another. Allowing access for a specific interface does not restrict the mime types beyond what that interface was made for.

I think this is the issue: https://stackoverflow.com/a/60842121

@jloleysens
Copy link
Contributor

jloleysens commented Mar 21, 2024

So indirectly this issue is still related to CDN bc the latest test were done against these changes which puts blob:... as the base URL... calling relative paths in workers seems like it would have been an issue anyway.


I think we may need something like this: c3b3121

jloleysens added a commit that referenced this issue Mar 22, 2024
## Summary

Fix #179058

Update the `transformRequest` function to create URLs that are callable
from inside workers that don't share the same domain.

Proposal is to to convert absolute path values to absolute URLs, e.g.
`/my/path` => `https://my.origin/my/path`.

- [x] Blocked by #178669

## Test locally with CDN

Easiest way to test is via the observability project built on this PR
(see buildkite output), otherwise:

- Build CDN assets (`node ./scripts/build.js --skip-docker-ubi
--skip-docker-ubuntu --skip-docker-fips --skip-os-packages`)
- Unpack the CDN assets
`target/kibana-8.14.0-SNAPSHOT-cdn-assets.tar.gz` and serve them `npx
http-server -p 1772 --cors --gzip --brotli`, remember to change the hash
dir name to `XXXXXXXXXXXX`
- Serve via different domain eg:
```
## My test
127.0.0.1 my.cdn.test
```
- Configure Kibana to load assets `server.cdn.url: http://my.cdn.test`

---------

Co-authored-by: Eyo Okon Eyo <eyo.eyo@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Maps Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants