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

find hook for mailer service is missing #31

Closed
MarcGodard opened this issue May 12, 2022 · 1 comment · Fixed by feathersjs/feathers#2636
Closed

find hook for mailer service is missing #31

MarcGodard opened this issue May 12, 2022 · 1 comment · Fixed by feathersjs/feathers#2636

Comments

@MarcGodard
Copy link

MarcGodard commented May 12, 2022

To reproduce:

  • Install feathers
  • generate app
  • upgrade to dove
  • install this mailer package
  • user this package as a service like below:
// Initializes the `mailer` service on path `/mailer`
const hooks = require('./mailer.hooks')
const mailer = require('feathers-mailer')

module.exports = function (app) {
  const transporter = app.get('mailer')
  if (transporter.dkim.domainName === 'SITE_DOMAIN') delete transporter.dkim

  // Initialize our service with any options it requires
  app.use('/api/mailer', mailer(transporter, { from: transporter.auth.user }))

  // Get our initialized service so that we can register hooks
  const service = app.service('api/mailer')

  service.hooks(hooks)
}

Causes the following error with 5.0.0-pre.15 and up:

[nodemon] starting `node server/ --trace-warnings --abort-on-uncaught-exception`
/home/marcgodard/Documents/Github/template/node_modules/@feathersjs/feathers/lib/hooks/regular.js:122
                throw new Error(`'${method}' is not a valid hook method`);
                ^

Error: 'find' is not a valid hook method
    at /home/marcgodard/Documents/Github/template/node_modules/@feathersjs/feathers/lib/hooks/regular.js:122:23
    at Array.forEach (<anonymous>)
    at /home/marcgodard/Documents/Github/template/node_modules/@feathersjs/feathers/lib/hooks/regular.js:120:27
    at Array.forEach (<anonymous>)
    at createMap (/home/marcgodard/Documents/Github/template/node_modules/@feathersjs/feathers/lib/hooks/regular.js:115:24)
    at Service.regularHooks (/home/marcgodard/Documents/Github/template/node_modules/@feathersjs/feathers/lib/hooks/regular.js:163:21)
    at Service.service.hooks (/home/marcgodard/Documents/Github/template/node_modules/@feathersjs/feathers/lib/hooks/index.js:79:39)
    at Function.module.exports (/home/marcgodard/Documents/Github/template/server/services/mailer/mailer.service.js:27:11)
    at Function.configure (/home/marcgodard/Documents/Github/template/node_modules/@feathersjs/feathers/lib/application.js:43:18)
    at Function.module.exports (/home/marcgodard/Documents/Github/template/server/services/index.js:109:7)
    at Function.configure (/home/marcgodard/Documents/Github/template/node_modules/@feathersjs/feathers/lib/application.js:43:18)
    at Object.<anonymous> (/home/marcgodard/Documents/Github/template/server/app.js:81:5)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[nodemon] app crashed - waiting for file changes before starting...
@daffl
Copy link
Member

daffl commented May 17, 2022

Thank you for putting up the pull request. This was really a regression in v5 and should be back to the old behaviour with feathersjs/feathers#2636

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

Successfully merging a pull request may close this issue.

2 participants