Skip to content

Can not apply hooks #3576

@EmileSpecs

Description

@EmileSpecs

In the typed client (thus this is browser error) I get the following error:

500
Can not apply hooks. 'report' is not a function

at objectHooks (.../app/node_modules/.pnpm/@feathersjs+hooks@0.9.0/node_modules/@feathersjs/hooks/script/hooks.js:66:19)

Report is a custom function of the users service:
async report(data: ReportData, params: ServiceParams)

I also call some hooks on the custom method, i.e.:

app.service(userPath).hooks({
  before: {
    report: [authorizeHook()]
  }
})

I didn't get this when I used Feathers 5.0.24, so the only thing that changed is that I updated the Feathers API and client to 5.0.33.

The only relevant change I saw in the releases was that the typing for the service methods had changed, so I changed it to:
export const userMethods: Array<keyof UserService> = ['find', 'get', 'create', 'patch', 'remove', 'report']

That made no difference however, I still get the error.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions