"ceramic.index.queryIndex is not a function" error in local graphql:server

Hi, I’m running a local graphql server as described in the docs via “composedb graphql:server” to test query and mutation instructions. The deployed runtime composite contains a simple Profile type.

When running (any type of) query, the local server responds with “message”: “ceramic.index.queryIndex is not a function”.

Note: I had to change and overwrite the peer dependencies for graphql in the @composedb installation due to conflicting peer dependency versions of graphql and fixed it at 16.6.0. The default installation of @composedb (0.2.2) will not run graphql:… sub commands without this fix.
Could the version of graphql be related to my problem?

Thanks, Jan

For reference, this is part of the package.json in @composedb/cli I’m using to make graphql commands work. Note the “overrides” section.

  "dependencies": {
    "graphql": "16.6.0",
    "@ceramicnetwork/3id-did-resolver": "^2.1.7",
    "@ceramicnetwork/http-client": "^2.3.4",
    "@ceramicnetwork/stream-model": "^0.5.0",
    "@ceramicnetwork/stream-model-instance": "^0.4.1",
    "@ceramicnetwork/streamid": "^2.3.3",
    "@composedb/client": "^0.2.1",
    "@composedb/devtools": "^0.2.1",
    "@composedb/devtools-node": "^0.2.1",
    "@oclif/core": "^1.16.0",
    "@oclif/plugin-help": "^5.1.11",
    "@oclif/plugin-version": "^1.0.4",
    "cli-table3": "^0.6.2",
    "did-resolver": "^3.2.2",
    "dids": "^3.3.0",
    "env-paths": "^3.0.0",
    "fs-extra": "^10.0.1",
    "inquirer": "^8.2.4",
    "key-did-provider-ed25519": "^2.0.0",
    "key-did-resolver": "^2.1.1",
    "listr": "^0.14.3",
    "listr-update-renderer": "^0.5.0",
    "ora": "^6.1.0",
    "term-size": "^3.0.2",
    "uint8arrays": "^3.0.0"
  },
  "devDependencies": {
    "@ceramicnetwork/common": "^2.5.0",
    "@ceramicnetwork/core": "^2.9.0",
    "@composedb/types": "^0.2.1",
    "@swc-node/register": "^1.5.1",
    "@types/fs-extra": "^9.0.13",
    "@types/inquirer": "^8.2.1",
    "@types/jest": "^28.1.8",
    "@types/listr": "^0.14.4",
    "@types/node": "^18.7.13",
    "@types/update-notifier": "^6.0.1",
    "ajv": "^8.10.0",
    "execa": "^6.0.0",
    "jest-dev-server": "^6.0.3",
    "oclif": "^3.1.2",
    "strip-ansi": "~7.0.1"
  },
  "overrides": {
    "express-graphql@0.12.0": {
      "graphql": "16.6.0"
    }
  },

My setup:

model:

type Profile @createModel(accountRelation: SINGLE, description: "User profile info") {
  name: String! @string(maxLength: 100)
  description: String @string(maxLength: 2000)
  entityType: EntityType
}

enum EntityType {
  PERSON
  ENTITY
}

generated Query type:

type Query {
  """Fetches an object given its ID"""
  node(
    """The ID of an object"""
    id: ID!
  ): Node
  viewer: CeramicAccount
  profileIndex(
    """Returns the items in the list that come after the specified cursor."""
    after: String

    """Returns the first n items from the list."""
    first: Int

    """Returns the items in the list that come before the specified cursor."""
    before: String

    """Returns the last n items from the list."""
    last: Int
  ): ProfileConnection
}

"""An object with an ID"""
interface Node {
  """The id of the object."""
  id: ID!
}

type CeramicAccount implements Node {
  id: ID!
  isViewer: Boolean!
  profile: Profile
}

Query Request:

{
 profileIndex(first: 2) {
    edges {
      node {
        name
      }
    }
  }
}

Response:

{
  "errors": [
    {
      "message": "ceramic.index.queryIndex is not a function",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "profileIndex"
      ]
    }
  ],
  "data": {
    "profileIndex": null
  }
}

I restarted the Ceramic server to make sure indexes are being created

What stands out to me is the fact that the ComposeClient generated a “profileIndex” on the Query at all!? Because the “profile” is set as accountRelation: SINGLE, so why would it need pagination? The CeramicAccount has a single “profile” attribute as expected. Or can one really retrieve all profiles across all accounts via the profileIndex?
Could someone maybe comment on that?

@artur @paul, any idea what could be happening here?

Hi, please see the reply in Node for composeDb - #4 by paul

Hi Paul, thanks for the reply!

I installed “@composedb” CLI (v0.2.4) via NPX and it was installed with the below dependencies in package.json. Are you saying (in the other post) that I need to fixate the ceramic dependencies to particular versions to avoid downloading newer ones that might be causing problems?
To re-iterate: I’m using the out-of-the-box ComposeDB and have not intentionally updated any ceramic dependencies. If newer (incompatible) Ceramic modules are used, they were pulled in due to the use of “^” in the package.json. I can adapt that, but I’d be changing the default ComposeDB package.json, so I want to make sure that this is what you’re suggesting.

  "@ceramicnetwork/3id-did-resolver": "^2.1.7",
    "@ceramicnetwork/http-client": "^2.3.4",
    "@ceramicnetwork/stream-model": "^0.5.0",
    "@ceramicnetwork/stream-model-instance": "^0.4.1",
    "@ceramicnetwork/streamid": "^2.3.3",
    "@composedb/client": "^0.2.1",
    "@composedb/devtools": "^0.2.1",
    "@composedb/devtools-node": "^0.2.1",
    "@oclif/core": "^1.16.0",
    "@oclif/plugin-help": "^5.1.11",
    "@oclif/plugin-version": "^1.0.4",
    "cli-table3": "^0.6.2",
    "did-resolver": "^3.2.2",
    "dids": "^3.3.0",
    "env-paths": "^3.0.0",
    "fs-extra": "^10.0.1",
    "inquirer": "^8.2.4",
    "key-did-provider-ed25519": "^2.0.0",
    "key-did-resolver": "^2.1.1",
    "listr": "^0.14.3",
    "listr-update-renderer": "^0.5.0",
    "ora": "^6.1.0",
    "term-size": "^3.0.2",
    "uint8arrays": "^3.0.0"