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

hook failed with auth & sync #540

Closed
dpoellath opened this Issue Jul 6, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@dpoellath
Copy link

dpoellath commented Jul 6, 2017

get error in hook updateEntity from file update-entity.js on patched event (on user model), because hook (2nd argument) is not delivered over sync


TypeError: Cannot read property 'app' of undefined
    at Object.updateEntity (/Users/user/server/node_modules/feathers-authentication/lib/socket/update-entity.js:5:17)
    at emitOne (events.js:101:20)
    at Object.emit [as _emit] (events.js:188:7)
    at /Users/user/server/node_modules/feathers-sync/src/amqp.js:99:27
    at /Users/user/server/node_modules/feathers-sync/src/amqp.js:13:7
    at Array.forEach (native)
    at onmessage (/Users/user/server/node_modules/feathers-sync/src/amqp.js:12:24)
    at channel.consume.noAck (/Users/user/server/node_modules/feathers-sync/src/amqp.js:36:13)
    at Channel.BaseChannel.dispatchMessage (/Users/user/server/node_modules/amqplib/lib/channel.js:466:12)
    at Channel.BaseChannel.handleDelivery (/Users/user/server/node_modules/amqplib/lib/channel.js:475:15)
    at emitOne (events.js:96:13)
    at Channel.emit (events.js:188:7)
    at /Users/user/server/node_modules/amqplib/lib/channel.js:263:10
    at Channel.content [as handleMessage] (/Users/user/server/node_modules/amqplib/lib/channel.js:316:9)
    at Channel.C.acceptMessageFrame (/Users/user/server/node_modules/amqplib/lib/channel.js:231:31)
    at Channel.C.accept (/Users/user/server/node_modules/amqplib/lib/channel.js:384:17)
    at Connection.mainAccept [as accept] (/Users/user/server/node_modules/amqplib/lib/connection.js:63:33)
    at Socket.go (/Users/user/server/node_modules/amqplib/lib/connection.js:476:48)
    at emitNone (events.js:86:13)
    at Socket.emit (events.js:185:7)
    at emitReadable_ (_stream_readable.js:432:10)
    at emitReadable (_stream_readable.js:426:7)
    at readableAddChunk (_stream_readable.js:187:13)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:551:20)
@dpoellath

This comment has been minimized.

Copy link
Author

dpoellath commented Jul 6, 2017

update: could be fixed, if you write a wrapper for the hook, because you have the app object in the setup call, when you init the event listener (handler.js)

/src/socket/handler.js:157
(in)
entityService.on('updated', updateEntity(app));
entityService.on('patched', updateEntity(app));
(out)
entityService.on('updated', updateEntity);
entityService.on('patched', updateEntity);

/src/socket/update-entity.js:3
(in)
module.exports = (app) => (entity) => {
(out)
module.exports = function updateEntity (entity, meta) {
  const { app } = meta;

@dpoellath dpoellath changed the title auth & sync hook failed with auth & sync Jul 6, 2017

@marshallswain

This comment has been minimized.

Copy link
Member

marshallswain commented Jul 6, 2017

Thanks @dpoellath for figuring this out.

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Jul 7, 2017

Related: feathersjs-ecosystem/feathers-sync#32

I will definitely give feathers-sync some more love with the next version.

@marshallswain from what I understand I think the fix @dpoellath suggested would still be worth implementing.

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Jul 24, 2017

Is this still an issue? Seems to be fixed here but there is still some outstanding work to be done to address feathersjs-ecosystem/feathers-sync#32?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.