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

app.authenticate(): Warning: a promise was rejected with a non-error: [object Object] #191

Closed
foxhound87 opened this Issue Apr 29, 2016 · 13 comments

Comments

Projects
None yet
3 participants
@foxhound87
Copy link

foxhound87 commented Apr 29, 2016

This happens only in the production environment after a successful login,
it stops the execution of the current action.

The app is: https://github.com/foxhound87/rfx-stack

I disabled the minification:

Warning: a promise was rejected with a non-error: [object Object]
    at Socket.on (http://localhost:3000/build/bundle.js:49005:9)
    at Socket.Emitter.emit (http://localhost:3000/build/bundle.js:49073:21)
    at Socket.onevent (http://localhost:3000/build/bundle.js:48787:11)
    at Socket.onpacket (http://localhost:3000/build/bundle.js:48745:13)
    at Manager.<anonymous> (http://localhost:3000/build/bundle.js:37783:16)
    at Manager.Emitter.emit (http://localhost:3000/build/bundle.js:49073:21)
    at Manager.ondecoded (http://localhost:3000/build/bundle.js:48264:9)
    at Decoder.<anonymous> (http://localhost:3000/build/bundle.js:37783:16)
    at Decoder.Emitter.emit (http://localhost:3000/build/bundle.js:29390:21)
    at Decoder.add (http://localhost:3000/build/bundle.js:37350:13)
    at Manager.ondata (http://localhost:3000/build/bundle.js:48254:17)
    at Socket.<anonymous> (http://localhost:3000/build/bundle.js:37783:16)
From previous event:
    at authenticateSocket (http://localhost:3000/build/bundle.js:116466:11)
    at http://localhost:3000/build/bundle.js:116351:49
From previous event:
    at http://localhost:3000/build/bundle.js:116342:44
From previous event:
    at Object.app.authenticate (http://localhost:3000/build/bundle.js:116331:26)
    at AuthStore.login (http://localhost:3000/build/bundle.js:51286:31)
    at helper (http://localhost:3000/build/bundle.js:143958:62)
    at helper (http://localhost:3000/build/bundle.js:143975:13)
    at helper (http://localhost:3000/build/bundle.js:143975:13)
    at access (http://localhost:3000/build/bundle.js:143941:11)
    at dispatch (http://localhost:3000/build/bundle.js:29245:40)
    at handleOnSubmitFormLogin (http://localhost:3000/build/bundle.js:49642:29)
    at Object.invokeGuardedCallback (http://localhost:3000/build/bundle.js:35690:13)
    at executeDispatch (http://localhost:3000/build/bundle.js:31089:22)
    at Object.executeDispatchesInOrder (http://localhost:3000/build/bundle.js:31112:6)
    at executeDispatchesAndRelease (http://localhost:3000/build/bundle.js:28554:23)
    at executeDispatchesAndReleaseTopLevel (http://localhost:3000/build/bundle.js:28565:11)
    at Array.forEach (native)
    at forEachAccumulated (http://localhost:3000/build/bundle.js:47496:10)
    at Object.EventPluginHub.processEventQueue (http://localhost:3000/build/bundle.js:28727:8)
    at runEventQueueInBatch (http://localhost:3000/build/bundle.js:140232:19)
    at Object.ReactEventEmitterMixin.handleTopLevel [as _handleTopLevel] (http://localhost:3000/build/bundle.js:140243:6)
    at handleTopLevelImpl (http://localhost:3000/build/bundle.js:140325:25)
@marshallswain

This comment has been minimized.

Copy link
Member

marshallswain commented Apr 30, 2016

Will you post some of the code found at Socket.on (http://localhost:3000/build/bundle.js:49005:9) We need to know what module that's in.

@foxhound87

This comment has been minimized.

Copy link
Author

foxhound87 commented Apr 30, 2016

The line 49005 is called from this module:
https://github.com/component/emitter

    /**
     * Adds an `event` listener that will be invoked a single
     * time then automatically removed.
     *
     * @param {String} event
     * @param {Function} fn
     * @return {Emitter}
     * @api public
     */

    Emitter.prototype.once = function(event, fn){
      function on() {
        this.off(event, on);
        fn.apply(this, arguments); // LINE 49005
      }

      on.fn = fn;
      this.on(event, on);
      return this;
    };
@marshallswain

This comment has been minimized.

Copy link
Member

marshallswain commented Apr 30, 2016

Ok. That didn't help much, but there's something I do recognize further down in the stack trace: authenticateSocket is found here: https://github.com/feathersjs/feathers-authentication/blob/master/src/client/utils.js#L32. It looks to me like socket auth is failing. Try opening the code in your node_modules/feathers-authentication folder and finding this line:

socket.once('unauthorized', reject);

and replacing it with this:

socket.once('unauthorized', response => {
  reject(new Error(response))
});

And that should change the message you get to an actual error.

@foxhound87

This comment has been minimized.

Copy link
Author

foxhound87 commented Apr 30, 2016

I got the same error:

Error: [object Object]
    at Socket.socket.once.response (http://localhost:3000/build/bundle.js:116470:15)
    at Socket.on (http://localhost:3000/build/bundle.js:49005:9)
    at Socket.Emitter.emit (http://localhost:3000/build/bundle.js:49073:21)
    at Socket.onevent (http://localhost:3000/build/bundle.js:48787:11)
    at Socket.onpacket (http://localhost:3000/build/bundle.js:48745:13)
    at Manager.<anonymous> (http://localhost:3000/build/bundle.js:37783:16)
    at Manager.Emitter.emit (http://localhost:3000/build/bundle.js:49073:21)
    at Manager.ondecoded (http://localhost:3000/build/bundle.js:48264:9)
    at Decoder.<anonymous> (http://localhost:3000/build/bundle.js:37783:16)
    at Decoder.Emitter.emit (http://localhost:3000/build/bundle.js:29390:21)
    at Decoder.add (http://localhost:3000/build/bundle.js:37350:13)
    at Manager.ondata (http://localhost:3000/build/bundle.js:48254:17)
    at Socket.<anonymous> (http://localhost:3000/build/bundle.js:37783:16)
    at Socket.Emitter.emit (http://localhost:3000/build/bundle.js:29390:21)
    at Socket.onPacket (http://localhost:3000/build/bundle.js:58260:15)
    at WS.<anonymous> (http://localhost:3000/build/bundle.js:58077:11)
From previous event:
    at authenticateSocket (http://localhost:3000/build/bundle.js:116467:11)
    at http://localhost:3000/build/bundle.js:116352:49
From previous event:
    at http://localhost:3000/build/bundle.js:116343:44
From previous event:
    at Object.app.authenticate (http://localhost:3000/build/bundle.js:116332:26)
    at AuthStore.login (http://localhost:3000/build/bundle.js:51287:31)
    at helper (http://localhost:3000/build/bundle.js:143967:62)
    at helper (http://localhost:3000/build/bundle.js:143984:13)
    at helper (http://localhost:3000/build/bundle.js:143984:13)
    at access (http://localhost:3000/build/bundle.js:143950:11)
    at dispatch (http://localhost:3000/build/bundle.js:29245:40)
    at handleOnSubmitFormLogin (http://localhost:3000/build/bundle.js:49642:29)
    at Object.invokeGuardedCallback (http://localhost:3000/build/bundle.js:35690:13)
    at executeDispatch (http://localhost:3000/build/bundle.js:31089:22)
    at Object.executeDispatchesInOrder (http://localhost:3000/build/bundle.js:31112:6)
    at executeDispatchesAndRelease (http://localhost:3000/build/bundle.js:28554:23)
    at executeDispatchesAndReleaseTopLevel (http://localhost:3000/build/bundle.js:28565:11)
    at Array.forEach (native)
    at forEachAccumulated (http://localhost:3000/build/bundle.js:47496:10)
    at Object.EventPluginHub.processEventQueue (http://localhost:3000/build/bundle.js:28727:8)
    at runEventQueueInBatch (http://localhost:3000/build/bundle.js:140241:19)
    at Object.ReactEventEmitterMixin.handleTopLevel [as _handleTopLevel] (http://localhost:3000/build/bundle.js:140252:6)
    at handleTopLevelImpl (http://localhost:3000/build/bundle.js:140334:25)
@marshallswain

This comment has been minimized.

Copy link
Member

marshallswain commented Apr 30, 2016

Do a console.log(response) before the resolve so you can inspect the error and post the contents, please.

On Apr 30, 2016, at 6:30 AM, Claudio Savino notifications@github.com wrote:

I got the same error:

Error: [object Object]
at Socket.socket.once.response (http://localhost:3000/build/bundle.js:116470:15)
at Socket.on (http://localhost:3000/build/bundle.js:49005:9)
at Socket.Emitter.emit (http://localhost:3000/build/bundle.js:49073:21)
at Socket.onevent (http://localhost:3000/build/bundle.js:48787:11)
at Socket.onpacket (http://localhost:3000/build/bundle.js:48745:13)
at Manager. (http://localhost:3000/build/bundle.js:37783:16)
at Manager.Emitter.emit (http://localhost:3000/build/bundle.js:49073:21)
at Manager.ondecoded (http://localhost:3000/build/bundle.js:48264:9)
at Decoder. (http://localhost:3000/build/bundle.js:37783:16)
at Decoder.Emitter.emit (http://localhost:3000/build/bundle.js:29390:21)
at Decoder.add (http://localhost:3000/build/bundle.js:37350:13)
at Manager.ondata (http://localhost:3000/build/bundle.js:48254:17)
at Socket. (http://localhost:3000/build/bundle.js:37783:16)
at Socket.Emitter.emit (http://localhost:3000/build/bundle.js:29390:21)
at Socket.onPacket (http://localhost:3000/build/bundle.js:58260:15)
at WS. (http://localhost:3000/build/bundle.js:58077:11)
From previous event:
at authenticateSocket (http://localhost:3000/build/bundle.js:116467:11)
at http://localhost:3000/build/bundle.js:116352:49
From previous event:
at http://localhost:3000/build/bundle.js:116343:44
From previous event:
at Object.app.authenticate (http://localhost:3000/build/bundle.js:116332:26)
at AuthStore.login (http://localhost:3000/build/bundle.js:51287:31)
at helper (http://localhost:3000/build/bundle.js:143967:62)
at helper (http://localhost:3000/build/bundle.js:143984:13)
at helper (http://localhost:3000/build/bundle.js:143984:13)
at access (http://localhost:3000/build/bundle.js:143950:11)
at dispatch (http://localhost:3000/build/bundle.js:29245:40)
at handleOnSubmitFormLogin (http://localhost:3000/build/bundle.js:49642:29)
at Object.invokeGuardedCallback (http://localhost:3000/build/bundle.js:35690:13)
at executeDispatch (http://localhost:3000/build/bundle.js:31089:22)
at Object.executeDispatchesInOrder (http://localhost:3000/build/bundle.js:31112:6)
at executeDispatchesAndRelease (http://localhost:3000/build/bundle.js:28554:23)
at executeDispatchesAndReleaseTopLevel (http://localhost:3000/build/bundle.js:28565:11)
at Array.forEach (native)
at forEachAccumulated (http://localhost:3000/build/bundle.js:47496:10)
at Object.EventPluginHub.processEventQueue (http://localhost:3000/build/bundle.js:28727:8)
at runEventQueueInBatch (http://localhost:3000/build/bundle.js:140241:19)
at Object.ReactEventEmitterMixin.handleTopLevel as _handleTopLevel
at handleTopLevelImpl (http://localhost:3000/build/bundle.js:140334:25)

You are receiving this because you commented.
Reply to this email directly or view it on GitHub #191 (comment)

@foxhound87

This comment has been minimized.

Copy link
Author

foxhound87 commented Apr 30, 2016

It prints an empty object:

Object {} 
@marshallswain

This comment has been minimized.

Copy link
Member

marshallswain commented Apr 30, 2016

I'm not sure what that argument represents. Maybe log arguments and see if there's anything additional. Either way, it looks like the socket auth is failing.

@foxhound87

This comment has been minimized.

Copy link
Author

foxhound87 commented Apr 30, 2016

arguments prints an array like this: [Object, function], but I cannot find nothing interesting in it.
can you try installing my project? https://github.com/foxhound87/rfx-stack

@daffl

This comment has been minimized.

Copy link
Member

daffl commented May 1, 2016

I am getting the same error and it seems pretty strange but there is so much going on I'm not sure where to start. Is there a way to reduce this more while still reproducing the same error?

@foxhound87

This comment has been minimized.

Copy link
Author

foxhound87 commented May 3, 2016

I made a more compact version of the app, I hope can help.
https://bitbucket.org/foxhound87/feathers-auth-test

and I found another error:

Unhandled rejection [object Object]
    (No stack trace)
From previous event:
    at authenticateSocket (http://localhost:3000/build/bundle.js:49494:11)
    at http://localhost:3000/build/bundle.js:49379:49
From previous event:
    at http://localhost:3000/build/bundle.js:49370:44
From previous event:
    at Object.app.authenticate (http://localhost:3000/build/bundle.js:49359:26)
    at AuthStore.jwtAuth (http://localhost:3000/build/bundle.js:41636:31)
    at new AuthStore (http://localhost:3000/build/bundle.js:41621:22)
    at exports.default (http://localhost:3000/build/bundle.js:41510:12)
    at exports.default (http://localhost:3000/build/bundle.js:41525:43)
    at Object.<anonymous> (http://localhost:3000/build/bundle.js:41166:34)
    at __webpack_require__ (http://localhost:3000/build/bundle.js:20:30)
    at Object.<anonymous> (http://localhost:3000/build/bundle.js:71:19)
    at __webpack_require__ (http://localhost:3000/build/bundle.js:20:30)
    at http://localhost:3000/build/bundle.js:40:18
    at http://localhost:3000/build/bundle.js:43:10
@daffl

This comment has been minimized.

Copy link
Member

daffl commented May 20, 2016

I followed the readme of the more compact version but I am not sure how to reproduce the error with it.

@foxhound87

This comment has been minimized.

Copy link
Author

foxhound87 commented May 20, 2016

Just register a new user, then login. You should get the error

@foxhound87

This comment has been minimized.

Copy link
Author

foxhound87 commented May 20, 2016

Keep in mind that it happen on production enviroment.

so you have to run:

npm install
npm run build:all
npm run server:prod
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.