Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot apply hooks. "customMethod" is not a function #118

Closed
lyricsking opened this issue Mar 15, 2023 · 4 comments
Closed

Cannot apply hooks. "customMethod" is not a function #118

lyricsking opened this issue Mar 15, 2023 · 4 comments

Comments

@lyricsking
Copy link

lyricsking commented Mar 15, 2023

I have been stucked with this issue for over days and searched for a way of this, but failed.
Version:
feathersjs v5.0.0
feathers-pinia v2.0.0-pre.14
Nodejs v16

Error

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

at hooks (./node_modules/@feathersjs/hooks/script/index.js:50:43)
at Feathers.hookMixin (./node_modules/@feathersjs/feathers/lib/hooks.js:156:23)
at ./node_modules/@feathersjs/feathers/lib/application.js:116:40
at Array.forEach ()
at Feathers.use (./node_modules/@feathersjs/feathers/lib/application.js:116:21)
at Feathers.twilioClient (./node_modules/feedpal-feathers-api2/lib/services/twilio/twilio.shared.js:8:12)
at Feathers.configure (./node_modules/@feathersjs/feathers/lib/application.js:37:18)
at Proxy.createClient (./node_modules/feedpal-feathers-api2/lib/client.js:26:12)
at ./plugins/1.feathers.ts:25:37

How to reproduce?

Follow the official guide to generate api backend

Generate a custom service with atleast a method other than the default methods e.g sendVerification

Add a hook for the custom method i.e sendVerification in a before hook object for the custom service

Generate the typed client as package by running npm run dev and npm run bundle:client

Follow the official feathers-pinia tutorial to create a frontend client to consume the created api above

Add the generated typed client generated using npm run bundle:client as a dependency.

Run npm run dev on the feathers-pinia

@marshallswain
@FossPrime
@amoghpalnitkar

@FossPrime
Copy link
Contributor

Can you reproduce it in https://feathers.new and share the link?

@marshallswain
Copy link
Owner

@lyricsking, this error is coming from the Feathers Client and not from feathers-pinia. It would be best to ask a question in Discord for this issue. There's no way we can help you without seeing code. I'll leave this open for a couple of days if you'd like to get some help through this issue. If you want faster support, hit up Discord and make sure to include some code.

@lyricsking
Copy link
Author

@marshallswain thanks the error seems disappeared after updating and is fine now.
However, I'm still learning, so pardon my ignorance and kindly help me understand how I can work with custom method using feathers-pinia.
I'm trying to make a request to a custom method in vue component. I understand I can access the predefined standard feathers method (create, find, get, update and patch) but how would access custom method like e.g instance.customMethod()

@marshallswain
Copy link
Owner

@lyricsking, I recommend upgrading to Feathers-Pinia 3 if you haven't yet. Once you've upgraded, you can follow the advice I've given here: #122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants