Closed strk closed 8 years ago
I found the actual replace. And I also found that err.stack is undefined (would be good to always print errors via 'new Error')
I'm reopening this as I'm still getting it, and I finally think it's happening within "carto" node.js module itself, when trying to render this:
{"srs":"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over","Stylesheet":[{"id":"tile_style"}],"Layer":[{"clear_label_cache":false,"queryable":false,"maximum_scale_denominator":1.7976931348623157e+308,"minimum_scale_denominator":0,"datasource":{"type":"vector"},"styles":["layer"],"srs":"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over","active":true,"name":"layer"}]}
npm ls | grep carto
reveals there are two different version being used, one of which seems to be a cartodb
version (expected?):
/docker-systemapic/modules/pile(postgis_raster)$ npm ls | grep carto
├─┬ carto@0.14.1
│ ├─┬ carto@0.9.5-cdb2
Got it, the inner carto is a dependency of grainstore@1.1.1
-- I didn't know we were using grainstore here, I'm surprised anyone would want to use that :)
note to self: I left cartodb while grainstore was at version 0.22.1
I think the CSS is missing a full datasource. Expanded:
{
"srs":"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Stylesheet": [
{"id":"tile_style"}
],
"Layer": [{
"clear_label_cache": false,
"queryable": false,
"maximum_scale_denominator": 1.7976931348623157e+308,
"minimum_scale_denominator":0,
"datasource": {
"type":"vector"
},
"styles": ["layer"],
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"active": true,
"name": "layer"
}]
}
Filed upstream (as I think carto should not throw in any case): https://github.com/mapbox/carto/issues/430
For comparison, this is the CSS rendered for a vector layer:
{
"srs":"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@n ull +wktext +no_defs +over",
"Stylesheet":[
{"id":"tile_style",
"data":"@polygon_opacity: 1;\n#layer {\n\n\tpolygon-opacity: @polygon_opacity;\n\n\tpo lygon-fill: red;\n\n}"}
],
"Layer":[{
"clear_label_cache":false,
"queryable":false,
"maximum_scale_denominator":1.7976931348623157e+308,
"minimum_scale_d enominator":0,
"datasource":{
"type":"vector"
},
"styles":["layer"],
"srs":"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1 .0 +units=m +nadgrids=@null +wktext +no_defs +over",
"active":true,
"name":"layer"
}]
}
So the problem is not with the datasource
, but maybe with the lack of data
inside Stylesheet
.
The data
element is set from the cartoRenderer first argument:
// convert CartoCSS to Mapnik XML
cartoRenderer : function (css, layer, callback) {
var options = {
// srid 3857
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Stylesheet": [{
"id" : 'tile_style',
"data" : css
}],
"Layer" : [layer]
}
So I guess it is undefined as a parameter, and disappears on JSON.stringify, I guess ?
Confirmed:
> a = { x : undefined }
{ x: undefined }
> JSON.stringify(a);
'{}'
Ok, closing this -- I clearly see now that the proiblem is a missing CartoCSS for raster, and it's clear why (needed to be fixed in systemapic.js)
An extract from pile logs (trying to serve raster/postgis tiles):
It isn't easy to find the offending
replace
call. Could that message include a stack trace, for development runs ?