Joystream / hydra

A Substrate indexing framework
49 stars 44 forks source link

Hydra indexer uses a too old version of polkadot/api which does not work with my substrate project #470

Closed librelois closed 2 years ago

librelois commented 2 years ago

I can't get Hydra to work with my substrate project, I have an error that I know happens when polkadot/api is not up to date.

I clarify that my substrate project works very well with polkadotjs app.

Here are my logs:

hydra-indexer_1          | 2022-01-24T02:08:47.277Z index-builder:redis-factory Initializing Redis Client Factory
hydra-indexer_1          | 2022-01-24T02:08:47.277Z index-builder:redis-factory Using redis://redis:6379/0 for Redis clients
hydra-indexer_1          | 2022-01-24T02:08:47.279Z index-builder:indexer Starting Index Builder
hydra-indexer_1          | 2022-01-24T02:08:47.284Z index-builder:indexer Spawned worker.
hydra-indexer_1          | 2022-01-24T02:08:47.289Z index-builder:indexer Last indexed block in the database: -1
hydra-indexer_1          | 2022-01-24T02:08:47.289Z index-builder:indexer Starting the block indexer at block 0
duniter-1                | 2022-01-24 02:08:47 Accepted a new tcp connection from 172.19.0.5:39334.    
hydra-indexer_1          | 2022-01-24 02:08:47        REGISTRY: Error: Unable to create Enum via index 14, in V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12
hydra-indexer_1          |     at assert (/home/hydra/node_modules/@polkadot/util/assert.cjs:34:11)
hydra-indexer_1          |     at createFromValue (/home/hydra/node_modules/@polkadot/types/codec/Enum.cjs:87:20)
hydra-indexer_1          |     at decodeFromValue (/home/hydra/node_modules/@polkadot/types/codec/Enum.cjs:118:14)
hydra-indexer_1          |     at decodeEnum (/home/hydra/node_modules/@polkadot/types/codec/Enum.cjs:142:10)
hydra-indexer_1          |     at new Enum (/home/hydra/node_modules/@polkadot/types/codec/Enum.cjs:196:21)
hydra-indexer_1          |     at new <anonymous> (/home/hydra/node_modules/@polkadot/types/codec/Enum.cjs:211:9)
hydra-indexer_1          |     at new Type (/home/hydra/node_modules/@polkadot/types/create/registry.cjs:349:16)
hydra-indexer_1          |     at decodeU8a (/home/hydra/node_modules/@polkadot/types/codec/utils/decodeU8a.cjs:24:19)
hydra-indexer_1          |     at decodeStruct (/home/hydra/node_modules/@polkadot/types/codec/Struct.cjs:98:41)
hydra-indexer_1          |     at new Struct (/home/hydra/node_modules/@polkadot/types/codec/Struct.cjs:132:26)
hydra-indexer_1          | 2022-01-24 02:08:47        RPC-CORE: getMetadata(at?: BlockHash): Metadata:: createType(Metadata):: Unable to create Enum via index 14, in V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12
hydra-indexer_1          | 2022-01-24 02:08:47        API/INIT: Error: FATAL: Unable to initialize the API: createType(Metadata):: Unable to create Enum via index 14, in V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12
hydra-indexer_1          |     at EventEmitter.value (/home/hydra/node_modules/@polkadot/api/base/Init.cjs:91:25)
hydra-indexer_1          |     at processTicksAndRejections (internal/process/task_queues.js:95:5)
hydra-indexer_1          | 2022-01-24 02:08:47        API/INIT: Error: createType(Metadata):: Unable to create Enum via index 14, in V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12
hydra-indexer_1          |     at createTypeUnsafe (/home/hydra/node_modules/@polkadot/types/create/createType.cjs:66:11)
hydra-indexer_1          |     at RpcCore._formatOutput (/home/hydra/node_modules/@polkadot/rpc-core/index.cjs:387:41)
hydra-indexer_1          |     at callWithRegistry (/home/hydra/node_modules/@polkadot/rpc-core/index.cjs:253:42)
hydra-indexer_1          |     at processTicksAndRejections (internal/process/task_queues.js:95:5)
ondratra commented 2 years ago

Hi. Looking at indexer's and processor's package.jsons, I see there is a fixed dependency on "@polkadot/api": "5.9.1". That is likely the cause of your problem.

There is a successor project to Joystream Hydra called Subsquid https://github.com/subsquid/squid . It should have better support for the newest Polkadot API and many other goodies. You can set it up in a similar way as Hydra (see Subsquid's docs for more info). Joystream project will also migrate from Hydra to Subsquid in the near future. Thus, this particular issue will not be fixed in this repo.