2

So I'm trying to run the indexer on localnet following the official tutorial https://docs.near.org/docs/tutorials/near-indexer

However when I run cargo run -- init to generate the localnet json config I get this error

    Finished dev [unoptimized + debuginfo] target(s) in 17.62s
     Running `target/debug/example-indexer init`
thread 'main' panicked at 'Failed to deserialize config: Error("expected value", line: 1, column: 1)', /home/francois/.cargo/git/checkouts/nearcore-5bf7818cf2261fd0/a44be20/nearcore/src/config.rs:499:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

At some point it seems the json is not created or not created properly I guess, the function crashing in config.rf line 499 is

impl From<&str> for Config {
    fn from(content: &str) -> Self {
        serde_json::from_str(content).expect("Failed to deserialize config")
    }
}

It's quite difficult to debug since cargo run -- init is using some inner near function (also I'm new to rust).

the config.json file is created but it seems the permission are not set properly by the script, the content of config.json is

"<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message> ... "

If anyone from the community has encountered this problem or has a hint it would be great!! thanks a lot !

François Richard
  • 6,817
  • 10
  • 43
  • 78

2 Answers2

1

In the tutorial you referenced, it mentions a similar error, and suggests the following:

  • Open your config.json located in the .near folder in the root of your home directory. ( ~/.near/config.json )
  • In this file, locate: "tracked_shards": [] and change the value to [0].
  • Save the file and try running your indexer again.
BenTheHumanMan
  • 327
  • 2
  • 11
0

So I had the wrong config with download_config: false, It should be download_config: false, for the localnet use

François Richard
  • 6,817
  • 10
  • 43
  • 78
  • `download_config: false,` and `download_config: false,` say the same thing. What do you mean? – Ryan Nov 28 '21 at 19:39