In my case, I used the wrong format of the API ID.
resolverOf value should contain exact API, e.g. ID is news-item => resolverOf: 'application::news-item.news-item.count',
And so is in the resolver,
resolver: async (obj, options) => {
return await strapi.api['news-item'].services['news-item'].count(options.where || {});
},
You can use file structure for reference, where each chain in the call is a folder name.
api
- news-item
- services
- news-item.js