cardano-foundation / cardano-graphql

GraphQL API for Cardano
Apache License 2.0
263 stars 104 forks source link

field 'epochs' not found in type: 'query_root' #827

Closed liv-io closed 1 year ago

liv-io commented 1 year ago

Summary

Hello, I am unable to run cardano-graphql-background in the preview environment. I am running the whole stack as a "Podman Pod" (like Docker Compose) on a single virtual machine.

I would appreciate any inputs and help. Please let me know if you need more details of my setup.

Steps to reproduce the bug

  1. Run the listed software versions against the preview network
  2. Ensure cardano-node and cardano-db-sync are fully synchronized
  3. Ensure cardano-ogmios and cardano-graphql-engine are running
  4. Start cardano-graphql-background
  5. Observe output

Actual Result

Expected Result

I would expect cardano-graphql-background to run without throwing errors, especially on a new and clean database/db-sync.

Environment

Unfortunately, I fail at installing and running this CLI:

root@pod_cardano:/usr/local/src/cardano-graphql/node_modules# npx @cardano-graphql/cli system-info
sh: 1: cannot create buildcheck.gypi: Permission denied
internal/modules/cjs/loader.js:934
  throw err;
  ^

Error: Cannot find module '/root/.npm/_npx/1537/lib/node_modules/@cardano-graphql/cli/node_modules/ssh2/install.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:931:15)
    at Function.Module._load (internal/modules/cjs/loader.js:774:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ssh2@1.11.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ssh2@1.11.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-02-27T10_49_13_748Z-debug.log
Install for [ '@cardano-graphql/cli@latest' ] failed with code 1

Platform

Platform version

Ubuntu 22.04 LTS

Runtime

Runtime version

node: v14.21.3

liv-io commented 1 year ago

I thought I additionally share an excerpt of my other containers:

liv-io commented 1 year ago

Alright, I might have found the solution to my issue. The cardano-graphql-engine container is supposed to have the following environment variable:

export HASURA_GRAPHQL_DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}

It doesn't make much sense to me, as I've cleanly supplied all parameters on the command-line:

/usr/local/bin/graphql-engine --host localhost --port 5432 --user dbsync --password dbsync --dbname dbsync serve

I will report back, once I made further progress.

liv-io commented 1 year ago

:heavy_check_mark: Solved

After adding the HASURA_GRAPHQL_DATABASE_URL environment variable to the entrypoint script of the hasura-graphql-engine container, the cardano-graphql-background service started working.