Indexing got stuck for simple subgraph

Hello,

I was trying to deploy a subgraph to the graph’s hosted service, but the indexing process got stuck indefinitely. So I did some tests with a simple subgraph with a little bit of modification to the sample code.

I noticed that when there are callHandlers in my subgraph.yaml, the indexing always gets stuck.
The subgraph works if I remove the callHandlers section.

Can someone help me to check if it’s the code that is causing the issue? Or something happened to the indexers? Thanks a lot

Here is my subgraph.yaml:

specVersion: 0.0.2
description: Gravatar for Ethereum
repository: https://github.com/graphprotocol/example-subgraph
schema:
  file: ./schema.graphql
dataSources:
  - kind: ethereum/contract
    name: Gravity
    network: rinkeby
    source:
      address: '0xA752be0580b7378C67dCc516335Ce7712290A67F'
      abi: Gravity
      startBlock: 9697590
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.5
      language: wasm/assemblyscript
      entities:
        - Gravatar
      abis:
        - name: Gravity
          file: ./abis/Gravity.json
      eventHandlers:
        - event: NewGravatar(uint256,address,string,string)
          handler: handleNewGravatar
        - event: UpdatedGravatar(uint256,address,string,string)
          handler: handleUpdatedGravatar
      callHandlers:
        - function: updateGravatarImage(string)
          handler: handleUpdateGravatarImage
      file: ./src/mapping.ts

And my mapping.ts:

import { BigInt } from '@graphprotocol/graph-ts';
import {
  NewGravatar,
  UpdatedGravatar,
  UpdateGravatarImageCall,
} from '../generated/Gravity/Gravity';
import { Gravatar, Stats } from '../generated/schema';

export function handleNewGravatar(event: NewGravatar): void {
  let gravatar = new Gravatar(event.params.id.toHex());
  gravatar.owner = event.params.owner;
  gravatar.displayName = event.params.displayName;
  gravatar.imageUrl = event.params.imageUrl;
  gravatar.save();
}

export function handleUpdatedGravatar(event: UpdatedGravatar): void {
  let id = event.params.id.toHex();
  let gravatar = Gravatar.load(id);
  if (gravatar == null) {
    gravatar = new Gravatar(id);
  }
  gravatar.owner = event.params.owner;
  gravatar.displayName = event.params.displayName;
  gravatar.imageUrl = event.params.imageUrl;
  gravatar.save();
}

export function handleUpdateGravatarImage(call: UpdateGravatarImageCall): void {
  let id = call.transaction.from.toHex();
  let stats = Stats.load(id);
  if (stats == null) {
    stats = new Stats(id);
  }
  stats.numImageUpdatesCalled = stats.numImageUpdatesCalled.plus(new BigInt(1));
  stats.save();
}

Hi! Your subgraph is being deployed to Rinkeby. callHandlers aren’t supported on Rinkeby (see docs here). This could certainly do with a more helpful error message / failure state, if you didn’t see anything in the logs?
In general you will be able to get more immediate help in the Graph Protocol discord, in the #subgraph-development or #hosted-service channels. Thanks!

Thank you very much, adamfuller. That’s really helpful. Yeah, giving back some error message would have helped a lot.

I will try it out on other networks