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

Cannot read property 'replace' of undefined #328

Closed
tajchert opened this issue Mar 14, 2021 · 1 comment
Closed

Cannot read property 'replace' of undefined #328

tajchert opened this issue Mar 14, 2021 · 1 comment

Comments

@tajchert
Copy link

tajchert commented Mar 14, 2021

I wanted to use Positron project.yml from CartoDB/basemap-styles as my style, and preview it in Kosmtik.
After running
kosmtik serve ~/basemap-styles-master/cartocss/web-styles/positron.tm2/project.yml
And opening local host in browser on Kosmtik port:
http://127.0.0.1:6789/positron.tm2/#15/37.8011/-122.4703
I get:

/usr/local/lib/node_modules/kosmtik/src/back/Utils.js:36
        return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) {
                   ^

TypeError: Cannot read property 'replace' of undefined
    at Object.template (/usr/local/lib/node_modules/kosmtik/src/back/Utils.js:36:20)
    at VectorBasedTile._render (/usr/local/lib/node_modules/kosmtik/src/back/VectorBasedTile.js:52:24)
    at VectorBasedTile.render (/usr/local/lib/node_modules/kosmtik/src/back/VectorBasedTile.js:112:10)
    at /usr/local/lib/node_modules/kosmtik/src/back/ProjectServer.js:78:21
    at /usr/local/lib/node_modules/kosmtik/node_modules/generic-pool/lib/generic-pool.js:291:11
    at loaded (/usr/local/lib/node_modules/kosmtik/node_modules/mapnik-pool/index.js:27:28)
[1]    14946 segmentation fault  kosmtik serve

Import of the style is fine (output):

[Core] No usable config file found in /Users/mtajchert/.config/kosmtik.yml
[Core] Loading plugin from ../plugins/base-exporters/index.js
[Core] Loading plugin from ../plugins/hash/index.js
[Core] Loading plugin from ../plugins/local-config/index.js
[Core] Loading plugin from ../plugins/datasource-loader/index.js
[Core] Loading project from /Users/mtajchert/Downloads/basemap-styles-master/cartocss/web-styles/positron.tm2/project.yml
[Core] PreviewServer started, you can browse http://127.0.0.1:6789
[Core] Creating metatiles cache dir tmp/positron.tm2/meta
[Core] Deleting previous metatiles tmp/positron.tm2/meta
[Core] Created vector cache dir tmp/positron.tm2/vector
[Local Config] Unable to load local config from /Users/mtajchert/Downloads/basemap-styles-master/cartocss/web-styles/positron.tm2/localconfig.js
[Error: File not found: /Users/mtajchert/Downloads/basemap-styles-master/cartocss/web-styles/positron.tm2/localconfig.js]
[Core] Generating Mapnik XML…
[Core] Using mapnik version 3.0.20
[Core] Loading map…
[Core] Map ready
[Core] Loading map…
[Core] Map ready

Installed Kosmtik with Node 9.11.1 on MacOS Big Sur via NPM.
According to #275 Error: File not found: /Users/mtajchert/Downloads/basemap-styles-master/cartocss/web-styles/positron.tm2/localconfig.js is optional and is not an error that affect proper working also export of XML works fine.

@tajchert
Copy link
Author

tajchert commented Mar 17, 2021

This turned out to be an issue with schema URL inside Positron file (URL is not reachable).
URL http://fast.nutiteq.com/v3.json in line https://github.com/CartoDB/basemap-styles/blob/master/cartocss/web-styles/positron.tm2/project.yml#L36
Solution was to replace that one with one from Voyager style (as it works).

With that I'm closing this issue as this seems like a Positron style bug and not Kosmtik.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant