# Algorand indexer 2.8.0 troubleshooting

**URL:** <https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705>\
**Category:** Uncategorized\
**Created:** [January 10, 2022, 6:10pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705 "2022-01-10T18:10:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![scholtz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/scholtz/32/864_2.png) [@scholtz](https://forum.algorand.co/u/scholtz)\
**Post date:** [January 10, 2022, 6:10pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/1 "2022-01-10T18:10:20Z")

</div>

Hi, anybody else can guide me how to install successfully algorand indexer using specific algod node?

I have posted this issue to the indexer github:

> <https://github.com/algorand/indexer/issues/821>
>
> \### Subject of the issue
> 
> Hi, i am trying to create docker image from indexer,… but indexer does not work as documented.
> 
> The indexer is missing previous commands: 
> 
> -d, --algod string path to algod data dir, or $ALGORAND\_DATA
> --algod-net string host:port of algod
> --algod-token string api access token for algod
> 
> This behavior is not documented, so I assume it is a bug.
> 
> running 
> 
> \`\`\`algorand-indexer -P "$PG\_CONN\_STR" --algod-net="$ALGOD\_HOST" ---algod-token="$ALGOD\_TOKEN"\`\`\` 
> 
> returns 
> 
> \`\`\`{"error":"unknown flag: --algod-net","level":"error","msg":"an error occurred running indexer","time":"2022-01-10T18:01:43Z"\`\`\`
> 
> \`\`\`algorand-indexer help\`\`\` shows
> 
> \`\`\`Usage:
> indexer \[flags\]
> indexer \[command\]
> 
> Available Commands:
> daemon run indexer daemon
> help Help about any command
> 
> Flags:
> --cpuprofile string file to record cpu profile to
> -n, --dummydb use dummy indexer db
> -h, --help help for indexer
> -f, --logfile string file to write logs to, if unset logs are written to standard out
> -l, --loglevel string verbosity of logs: \[error, warn, info, debug, trace\] (default "info")
> --pidfile string file to write daemon's process id to
> -P, --postgres string connection string for postgres database
> -v, --version print version and exit
> 
> Use "indexer \[command\] --help" for more information about a command.
> \`\`\`
> 
> 
> \### Your environment
> 
> Pure installation from git release files.
> 
> \### Steps to reproduce
> 
> https://github.com/scholtz/AlgorandNodes/blob/15934b7fddefb81065999b78455d90d4f8cfb378/docker/compose-indexer-stable.yaml#L11
> \`\`\`
> FROM ubuntu
> USER root
> RUN mkdir /install
> WORKDIR /install
> ARG INDEXER\_VER
> ENV INDEXER\_VER=$INDEXER\_VER
> RUN echo "INDEXER\_VER: $INDEXER\_VER"
> RUN wget "https://github.com/algorand/indexer/releases/download/${INDEXER\_VER}/algorand-indexer\_${INDEXER\_VER}\_amd64.deb"
> RUN dpkg -i "algorand-indexer\_${INDEXER\_VER}\_amd64.deb"
> RUN algorand-indexer help
> \`\`\`
> 
> \### Expected behaviour
> 
> If this is expected behavior I expect this behavior should be documented here:
> https://github.com/algorand/indexer/blob/develop/README.md
> https://developer.algorand.org/docs/run-a-node/setup/indexer/
> 
> 
> \### Actual behaviour
> 
> users are confused by the documentation and inability to use the indexer in their environment

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [January 10, 2022, 7:19pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/2 "2022-01-10T19:19:44Z")

</div>

I’ve answered on the issue, but just for completeness:

I think you’re missing the `daemon` argument:

```bash
$ ./algorand-indexer daemon -v
2.8.0 compiled at 2021-11-29T19:26:17+0000 from git hash 06e7ca8eec01f907474a50cc2072581c0e662ccb

$ ./algorand-indexer daemon -h
run indexer daemon. Serve api on HTTP.

Usage:
  indexer daemon [flags]

Flags:
  -d, --algod string path to algod data dir, or $ALGORAND_DATA
      --algod-net string host:port of algod
      --algod-token string api access token for algod
      --allow-migration allow migrations to happen even when no algod connected
      --dev-mode allow performance intensive operations like searching for accounts at a particular round
  -g, --genesis string path to genesis.json (defaults to genesis.json in algod data dir if that was set)
  -h, --help help for daemon
      --metrics-mode string configure the /metrics endpoint to [ON, OFF, VERBOSE] (default "OFF")
      --no-algod disable connecting to algod for block following
      --read-timeout duration set the maximum duration for reading the entire request (default 5s)
  -S, --server string host:port to serve API on (default :8980) (default ":8980")
  -t, --token string an optional auth token, when set REST calls must use this token in a bearer format, or in a 'X-Indexer-API-Token' header
      --write-timeout duration set the maximum duration to wait before timing out writes to a http response, breaking connection (default 30s)

Global Flags:
      --cpuprofile string file to record cpu profile to
  -n, --dummydb use dummy indexer db
  -f, --logfile string file to write logs to, if unset logs are written to standard out
  -l, --loglevel string verbosity of logs: [error, warn, info, debug, trace] (default "info")
      --pidfile string file to write daemon's process id to
  -P, --postgres string connection string for postgres database
  -v, --version print version and exit

```

---

<div class="post-metadata">

**Author:** ![scholtz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/scholtz/32/864_2.png) [@scholtz](https://forum.algorand.co/u/scholtz)\
**Post date:** [January 10, 2022, 7:29pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/3 "2022-01-10T19:29:09Z")

</div>

thanks.

i have moved to the indexer.yaml configuration file, and it seems to be working with it

Any thoughts where i could be getting 404 error?

i have this in settings:

```auto
postgres-connection-string: "host=postgresql-postgresql-ha-pgpool.algorand-indexer-testnet port=5432 user=postgres password=..dbname=..sslmode=disable"
algod-address: "http://algo-set-service.algorand-testnet:4161"
algod-token: ".."
genesis: /app/genesis/testnet/genesis.json
api-token: ".."
metrics-mode: true

```

When i do

```auto
curl http://algo-set-service.algorand-testnet:4161/v1/testnet-v1.0/block/0 --output x.tmp

```

i get the first block successfuly

 ![image](https://us1.discourse-cdn.com/flex016/uploads/algorand/original/2X/0/06952a32de368f73686f58d0c928b77b36c889ce.png)

are there any other more verbose logs i could access?

for the record my

`algorand-indexer daemon -v`

shows

`2.8.0 compiled at 2021-11-29T16:42:46+0000 from git hash 06e7ca8eec01f907474a50cc2072581c0e662ccb`

---

<div class="post-metadata">

**Author:** ![scholtz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/scholtz/32/864_2.png) [@scholtz](https://forum.algorand.co/u/scholtz)\
**Post date:** [January 10, 2022, 7:46pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/4 "2022-01-10T19:46:52Z")

</div>

The same effect is when i use environmental variables

```auto
apiVersion: apps/v1 
kind: Deployment
metadata:
  name: algorand-indexer
  namespace: algorand-indexer-testnet
spec:
  selector:
    matchLabels:
      app: algorand-indexer
  replicas: 1
  template:
    metadata:
      labels:
        app: algorand-indexer
    spec:
      containers:
      - name: algorand-indexer
        image: scholtz2/algorand-indexer:2.8.0-stable
        command: ["/bin/bash", "-c", "--"]
        args: ["while true; do sleep 30; done;"]        
        env:
        - name: INDEXER_POSTGRES_CONNECTION_STRING
          value: ".."
        - name: INDEXER_ALGOD_ADDRESS
          value: "http://algo-set-service.algorand-testnet:4161"
        - name: INDEXER_ALGOD_TOKEN
          value: ".."
        - name: INDEXER_API_TOKEN
          value: ".."
        - name: INDEXER_DEV_MODE
          value: "1"
        - name: INDEXER_METRICS_MODE
          value: "1"
        - name: INDEXER_GENESIS
          value: "/app/genesis/testnet/genesis.json"

```

---

<div class="post-metadata">

**Author:** ![scholtz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/scholtz/32/864_2.png) [@scholtz](https://forum.algorand.co/u/scholtz)\
**Post date:** [January 10, 2022, 8:00pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/5 "2022-01-10T20:00:42Z")

</div>

When I tried to insert wrong address to the algod server, it shows the address where it tries to go…

[http://x:4161/v2/blocks/0?format=msgpack](http://x:4161/v2/blocks/0?format=msgpack)

the issue is that the algod does not serve v2 blocks for some reason…

Version:

```auto
algo@relaynode-ss-1:/app$ goal --version
12885032963
3.2.3.stable [rel/stable] (commit #d2289a52)

```

Config:

```auto
algo@relaynode-ss-1:/app$ cat data/config.json 
{
        "Version": 19,
        "Archival": true,
        "NetAddress": ":4161",
        "EnableMetricReporting": true,
        "EnableLedgerService": true,
        "EnableBlockService": true
}

```

Can the issue be that the 2.8.0 indexer does not communicate to 3.2.3 algod properly?

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [January 10, 2022, 8:05pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/6 "2022-01-10T20:05:18Z")

</div>

`NetAddress` is for relays.  
You need to use `EndpointAdress` instead, which by default use port 8080.  
See [Node configuration settings - Algorand Developer Portal](https://developer.algorand.org/docs/run-a-node/reference/config/)

---

<div class="post-metadata">

**Author:** ![scholtz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/scholtz/32/864_2.png) [@scholtz](https://forum.algorand.co/u/scholtz)\
**Post date:** [January 10, 2022, 8:05pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/7 "2022-01-10T20:05:20Z")

</div>

```auto
curl http://algo-set-service.algorand-testnet:4161/v2/testnet-v1.0/block/0 --output xx.tmp

```

works fine

```auto
curl http://algo-set-service.algorand-testnet:4161/v2/block/0?format=msgpack --output xx.tmp

```

works fine

```auto
curl http://algo-set-service.algorand-testnet:4161/v2/blocks/0?format=msgpack --output xx.tmp

```

also works fine…

so i am at square zero

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [January 10, 2022, 8:09pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/8 "2022-01-10T20:09:59Z")

</div>

`/v2/block` is not the algod REST endpoint.  
It is something else (maybe the relay endpoint).

The algod API REST endpoint that is used by the indexer (and all the SDKs) is: `/v2/blocks`. See [v2 - Algorand Developer Portal](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2blocksround)

You need to use the port `8080` or the port indicated by `EndpointAddress`.  
4161/4160 are ports that other relays connect to (specified by `NetAddress`). They are _not_ usable by SDKs and indexers.

---

<div class="post-metadata">

**Author:** ![scholtz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/scholtz/32/864_2.png) [@scholtz](https://forum.algorand.co/u/scholtz)\
**Post date:** [January 10, 2022, 8:36pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/9 "2022-01-10T20:36:06Z")

</div>

Thanks. the connection to algod works great now…

However i have this issue now:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/algorand/original/2X/5/53a05696826f9b854737d10e36ecb24cc3fdd486.png)

```auto
{"error":"AddBlock() err: TxWithRetry() err: attemptTx() err: AddBlock() adding block round 1 but next round to account is 0","level":"error","msg":"adding block 1 to database failed","time":"2022-01-10T20:33:32Z"}

```

---

<div class="post-metadata">

**Author:** ![scholtz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/scholtz/32/864_2.png) [@scholtz](https://forum.algorand.co/u/scholtz)\
**Post date:** [January 10, 2022, 8:54pm UTC](https://forum.algorand.co/t/algorand-indexer-2-8-0-troubleshooting/5705/10 "2022-01-10T20:54:28Z")

</div>

init script

```auto
echo "starting indexer"
date
algorand-indexer import
sleep 1
algorand-indexer daemon
sleep 1
algorand-indexer import
sleep 1
algorand-indexer daemon

while true; do echo "hello indexer" `date`; sleep 600;done

```

seemed to solve the issue for now

thanks @fabrice for great help with troubleshooting my issues
