"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"

Hi @paul, as an update: I fixated all ceramic dependencies in the ComposeDB/cli package.json to the version as you had specified in the other post. The “ceramic.index.queryIndex is not a function” error indeed went away and I’m now receiving a different error message … I guess that’s progress.

Here’s the ComposeDB/cli package.json override I had to do to make sure no higher versions are pulled in:

  "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.6.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"
    },
    "@ceramicnetwork/core@2.9.0": {
      "@ceramicnetwork/stream-caip10-link-handler": "2.1.4",
      "@ceramicnetwork/stream-caip10-link": "2.2.3",
      "@ceramicnetwork/stream-tile-handler": "2.2.7",
      "@ceramicnetwork/stream-tile": "2.4.3",
      "@ceramicnetwork/ipfs-topology": "2.2.0",
      "@ceramicnetwork/common": "2.6.0",
      "@ceramicnetwork/pinning-aggregation": "2.0.12",
      "@ceramicnetwork/pinning-ipfs-backend": "2.0.12"
    },
    "@ceramicnetwork/3id-did-resolver@2.1.7": {
      "@ceramicnetwork/stream-tile": "2.4.3"
    },
    "@ceramicnetwork/http-client@2.3.4": {
      "@ceramicnetwork/stream-tile": "2.4.3",
      "@ceramicnetwork/stream-caip10-link": "2.2.3"
    },
    "@ceramicnetwork/stream-caip10-link-handler@2.1.4": {
      "@ceramicnetwork/blockchain-utils-validation": "2.0.12",
      "@ceramicnetwork/common": "2.6.0"
    },
    "@ceramicnetwork/blockchain-utils-validation@2.0.12": {
      "@ceramicnetwork/blockchain-utils-linking": "2.0.11",
      "@ceramicnetwork/common": "2.6.0"
    }
  },

Now, when trying to access the Profile model in any way, I get this error:

{
  "errors": [
    {
      "message": "HTTP request to 'http://0.0.0.0:7007/api/v0/collection?model=kjzl6hvfrbw6c82knlga8nvrgze6l8rkns851fps0rbvs3dtxx7yh5ed30h6ys0&first=2' failed with status 'Internal Server Error': {\"error\":\"Index for historical data on kjzl6hvfrbw6c82knlga8nvrgze6l8rkns851fps0rbvs3dtxx7yh5ed30h6ys0 is not available\"}",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "profileIndex"
      ]
    }
  ],
  "data": {
    "profileIndex": null
  }
}

What am I missing?
I’ve been trying for over a week now to get to a working setup with ComposeDB and I really want to keep building with Ceramic, but I could really use some help at this point.

Thanks, Jan

Hi, sorry I don’t know about this issue, maybe @spencer or @ukstv could provide more insights here?

Can you share the contents of your daemon.config.json config file? On unix systems this defaults to being located in the ~/.ceramic/ directory.

You need to make sure the indexing.allow-queries-before-historical-sync flag is set to true (which should be the default anyway)

Thanks so much, @spencer! That was it. It was missing from the daemon config. I remember reading it in the docs, but thought it only applies to older (existing) ceramic nodes.