Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

currentEpoch is only available when close to the chain tip #372

Closed
smithy9901 opened this issue Nov 16, 2020 · 9 comments
Closed

currentEpoch is only available when close to the chain tip #372

smithy9901 opened this issue Nov 16, 2020 · 9 comments

Comments

@smithy9901
Copy link

smithy9901 commented Nov 16, 2020

At the request.

curl -X POST -H "Content-Type: application/json" -d '{"query": "{ cardano { currentEpoch { number blocks(limit:1, order_by: { forgedAt:desc}) { hash number slotNo slotInEpoch }}},}"}' http://localhost:3100/graphql

I'm getting an error

{"errors":[{"message":"currentEpoch is only available when close to the chain tip. This is expected during the initial chain-sync.","locations":[{"line":1,"column":3}],"path":["cardano"],"extensions":{"code":"INTERNAL_SERVER_ERROR","exception":{"stacktrace":["Error: currentEpoch is only available when close to the chain tip. This is expected during the initial chain-sync.","    at Object.<anonymous> (/application/packages/api-cardano-db-hasura/dist/executableSchema.js:103:40)","    at Generator.next (<anonymous>)","    at fulfilled (/application/packages/api-cardano-db-hasura/dist/executableSchema.js:5:58)","    at runMicrotasks (<anonymous>)","    at processTicksAndRejections (internal/process/task_queues.js:94:5)"]}}}],"data":null}

Although the query shows that the node is synched

curl -X POST -H "Content-Type: application/json" -d '{"query": "{ cardano { tip { number slotNo epoch { number } } } }"}' http://localhost:3100/graphql
{"data":{"cardano":{"tip":{"number":4958382,"slotNo":13969025,"epoch":null}}}}

query via yoroi-graphql-migration-backend

https://github.com/Emurgo/yoroi-graphql-migration-backend/blob/d6168de9400ce1d46ceaa8976ec613c7464417c1/src/services/bestblock.ts#L21

Components:
docker.io/inputoutput/cardano-graphql:3.0.0
docker.io/inputoutput/cardano-db-sync:6.0.0
docker.io/inputoutput/cardano-node:1.21.1
docker.io/hasura/graphql-engine:v1.3.2

@CyberCyclone
Copy link

CyberCyclone commented Nov 16, 2020

The query you gave worked for my node which is fully synced.

Have you used this query to check sync status? It's a lot more useful in these situations.

{ cardanoDbMeta { initialized syncPercentage }}

@smithy9901
Copy link
Author

curl -X POST -H "Content-Type: application/json" -d '{"query": "{ cardanoDbMeta { initialized syncPercentage }}"}' http://localhost:3100/graphql
{"data":{"cardanoDbMeta":{"initialized":false,"syncPercentage":100}}}

Judging by the answer, the nodes are syncd, but I ll try it just in case, resync the nodes

@smithy9901
Copy link
Author

The resync did not help, I still get an error message too.

@CyberCyclone
Copy link

The "initialized":false is odd. That usually happens if the node is still starting up or it fails to start up (typically because it needs a resync). Did you follow the resync guide from here: https://github.com/input-output-hk/cardano-graphql/wiki/Docker?

@CyberCyclone
Copy link

Can you please send a few screenshots of the console? There might be something in there that can help solve this.

@smithy9901
Copy link
Author

@CyberCyclone On which version cardano-graphql does the first query work?

curl -X POST -H "Content-Type: application/json" -d '{"query": "{ cardano { currentEpoch...

run:

- name: cardano-graphql
  image: inputoutput/cardano-graphql:3.0.0
  env:
    - ALLOW_INTROSPECTION=true
    - CACHE_ENABLED=true
    - POSTGRES_HOST=127.0.0.1
    - POSTGRES_PORT=5432
    - POSTGRES_DB=cexplorer
    - POSTGRES_PASSWORD=xxx
    - POSTGRES_USER=xxx
    - HASURA_URI=http://localhost:8080
  ports:
    - 3100:3100

log:

Applying PostgreSQL schema and Hasura metadata: Attempt 3 of 10, retrying...
{"level":"info","msg":"Applying migrations...","time":"2020-11-17T09:02:35Z"}
{"level":"info","msg":"nothing to apply","time":"2020-11-17T09:02:35Z"}

{"level":"info","msg":"Applying migrations...","time":"2020-11-17T09:02:35Z"}
{"level":"info","msg":"migrations applied","time":"2020-11-17T09:02:41Z"}

{"level":"info","msg":"Clearing metadata...","time":"2020-11-17T09:02:41Z"}
{"level":"info","msg":"Metadata cleared","time":"2020-11-17T09:02:41Z"}

{"level":"info","msg":"Applying metadata...","time":"2020-11-17T09:02:42Z"}
{"level":"info","msg":"Installing plugin cli-ext...","time":"2020-11-17T09:02:43Z"}
{"level":"info","msg":"plugin installed","name":"cli-ext","time":"2020-11-17T09:02:45Z"}
{"level":"info","msg":"Metadata applied","time":"2020-11-17T09:02:46Z"}

GraphQL HTTP server at http://0.0.0.0:3100/ started

@CyberCyclone
Copy link

I've just stopped and started my instance and it seems to have hit this bug on cardano-db-sync: IntersectMBO/cardano-db-sync#398

It's most likely what's broken for you. If you see the below then it's a bug they're trying to fix.

image

@CyberCyclone
Copy link

The above error from db-sync has been patched however it won't be known whether it 100% fixes the issue until the next epoch rollover. If you want to test it, it's on the db-sync master branch (so it's not officially released yet). So you'll need to edit the docker-compose file to pull the db-sync master branch docker image.

@rhyslbw
Copy link
Contributor

rhyslbw commented Nov 27, 2020

Feel free to reopen should this issue be present in cardano-graphql@3.0.1, which targets cardano-db-sync@6.0.1

@rhyslbw rhyslbw closed this as completed Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants