pelias / docker

Run the Pelias geocoder in docker containers, including example projects.
MIT License
338 stars 226 forks source link

pelias elastic create: Unexpected token } in JSON #166

Closed Skib4 closed 4 years ago

Skib4 commented 4 years ago

Hello again!

I've wanted to launch pelias again on clean environment, so I've stopped all containers, delete all old images and I've started procedure again.

When I've builded Pelias instance error has appeared:

root@srv ~/pelias/docker/projects/poland # pelias elastic create
internal/modules/cjs/loader.js:964
    throw err;
    ^

SyntaxError: /code/pelias.json: Unexpected token } in JSON at position 601
    at JSON.parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:961:27)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at getConfig (/code/pelias/schema/node_modules/pelias-config/index.js:66:21)
    at Object.generate (/code/pelias/schema/node_modules/pelias-config/index.js:24:18)
    at Object.<anonymous> (/code/pelias/schema/scripts/create_index.js:2:41)
    at Module._compile (internal/modules/cjs/loader.js:936:30)

My pelias.json file ( I've copied and edited pelias.json from /projects/france)

{
  "logger": {
    "level": "debug",
    "timestamp": false
  },
  "esclient": {
    "apiVersion": "6.8",
    "hosts": [
      { "host": "elasticsearch" }
    ]
  },
  "elasticsearch": {
    "settings": {
      "index": {
        "refresh_interval": "10s",
        "number_of_replicas": "0",
        "number_of_shards": "1"
      }
    }
  },
  "api": {
    "services": {
      "pip": { "url": "http://pip:4200" },
      "libpostal": { "url": "http://libpostal:4400" },
      "placeholder": { "url": "http://placeholder:4100" },
      "interpolation": { "url": "http://interpolation:4300" }
    },
  },
  "imports": {
    "adminLookup": {
      "enabled": true
    },
    "geonames": {
      "datapath": "/disk2/data/geonames",
      "countryCode": "PL"
    },
    "openstreetmap": {
      "download": [
        { "sourceURL": "http://download.geofabrik.de/europe/poland-latest.osm.pbf" }
      ],
      "leveldbpath": "/tmp",
      "datapath": "/disk2/data/openstreetmap",
      "import": [{
        "filename": "poland-latest.osm.pbf"
      }]
    },
    "openaddresses": {
      "datapath": "/disk2/data/openaddresses",
      "files": [ "pl/dolnoslaskie.csv", "pl/kujawsko-pomorskie.csv", "pl/lodzkie.csv", "pl/lubelskie.csv", "pl/lubuskie.csv", "pl/malopolski.csv", "pl/mazowieckie.csv", "pl/opolskie.csv", "pl/podkarpackie.csv", "pl/podlaskie.csv", "pl/pomorksie.csv", "pl/slaskie.csv", "pl/swietokrzyskie.csv", "pl/warminsko-mazurskie.csv", "pl/wielkopolskie.csv", "pl/zachodniopomorskie.csv" ]
    },
    "polyline": {
      "datapath": "/disk2/data/polylines",
      "files": [ "extract.0sv" ]
    },
    "whosonfirst": {
      "datapath": "/disk2/data/whosonfirst",
      "importVenues": false,
      "importPostalcodes": true,
      "importPlace": [ "85633723" ]
   }
 }
}

Can anyone tell me where is problem. Brackets looks ok

orangejulius commented 4 years ago

Hi @Skib4,

Line 27, after the services block. Extra trailing comma. Always tricky to track those down manually. I'd recommend something like jq to make it easier next time :)

Skib4 commented 4 years ago

Oh, stupid mistake. Thank's @orangejulius for help!