1

I'm currently running cardano-node version 1.35.0 and rosetta-server 1.8.2. The node is synced and I have blocks in postgres, however each query to rosetta throws an error:

curl -vvv -X POST 'http://<node-url>:8080/network/status' -H 'Content-Type: application/json' -d '{"network_identifier": {"blockchain": "cardano", "network": "mainnet"}}' | jq

{
  "code": 5000,
  "message": "An error occurred",
  "retriable": true,
  "details": {
    "message": "An error occurred for request 9149: column b.previous_id does not exist"
  }
}

The log shows an issue with the query, specifically the join.

2022-12-13T21:50:05Z 2022-12-13 21:50:05.011 UTC [11737] postgres@cexplorer STATEMENT:
2022-12-13T21:50:05Z    SELECT
2022-12-13T21:50:05Z      b.hash as hash,
2022-12-13T21:50:05Z      b.block_no as number,
2022-12-13T21:50:05Z      (b.time at time zone 'utc') as "createdAt",
2022-12-13T21:50:05Z      CASE
2022-12-13T21:50:05Z        WHEN b2.block_no IS NOT NULL THEN b2.block_no
2022-12-13T21:50:05Z        WHEN b3.block_no IS NOT NULL THEN b3.block_no
2022-12-13T21:50:05Z        ELSE 0
2022-12-13T21:50:05Z      END AS "previousBlockNumber",
2022-12-13T21:50:05Z      CASE
2022-12-13T21:50:05Z        WHEN b2.block_no IS NOT NULL THEN b2.hash
2022-12-13T21:50:05Z        WHEN b3.block_no IS NOT NULL THEN b3.hash
2022-12-13T21:50:05Z        WHEN b.block_no = 1 THEN b3.hash -- block 1
2022-12-13T21:50:05Z {"level":50,"time":1670968205012,"pid":125,"hostname":"coin-node-ada-kilo-coin-node-ada-kilo-0","reqId":8544,"length":112,"name":"error","severity":"ERROR","code":"42703","position":"684","file":"parse_relation.c","line":"3393","routine":"errorMissingColumn","msg":"[errorHandler] An error ocurred and will be sent as response","stack":"error: column b.previous_id does not exist\n    at Parser.parseErrorMessage (/cardano-rosetta-server/node_modules/pg-protocol/dist/parser.js:278:15)\n    at Parser.handlePacket (/cardano-rosetta-server/node_modules/pg-protocol/dist/parser.js:126:29)\n    at Parser.parse (/cardano-rosetta-server/node_modules/pg-protocol/dist/parser.js:39:38)\n    at Socket.<anonymous> (/cardano-rosetta-server/node_modules/pg-protocol/dist/index.js:8:42)\n    at Socket.emit (events.js:400:28)\n    at addChunk (internal/streams/readable.js:293:12)\n    at readableAddChunk (internal/streams/readable.js:267:9)\n    at Socket.Readable.push (internal/streams/readable.js:206:10)\n    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)","type":"Error","v":1}
2022-12-13T21:50:05Z        ELSE b.hash -- genesis
2022-12-13T21:50:05Z      END AS "previousBlockHash",
2022-12-13T21:50:05Z      b.tx_count as "transactionsCount",
2022-12-13T21:50:05Z      s.description as "createdBy",
2022-12-13T21:50:05Z      b.size as size,
2022-12-13T21:50:05Z      b.epoch_no as "epochNo",
2022-12-13T21:50:05Z      b.slot_no as "slotNo"
2022-12-13T21:50:05Z    FROM
2022-12-13T21:50:05Z      block b
2022-12-13T21:50:05Z      LEFT JOIN slot_leader s ON b.slot_leader_id = s.id
2022-12-13T21:50:05Z      LEFT JOIN block b2 ON b.previous_id = b2.id
2022-12-13T21:50:05Z      LEFT JOIN block b3 ON b2.previous_id = b3.id
2022-12-13T21:50:05Z    WHERE
2022-12-13T21:50:05Z      b.block_no = $1 AND
2022-12-13T21:50:05Z      $2 = $2
2022-12-13T21:50:05Z    LIMIT 1
2022-12-13T21:50:05Z null

I'm using this Dockerfile: https://github.com/input-output-hk/cardano-rosetta/blob/master/Dockerfile

I have tried syncing from scratch to no avail. Not sure what else I can do to make this work.

1 Answer 1

0

I was able to fix this by re-running the db migration cardano-db-tool run-migrations --mdir /cardano-db-sync/schema/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.