4

I'm currently facing an impossible to reproduce bug.

  1. My front error logger is Bugsnag and the front use Vue.js / vue router / vue apollo Graphql
  2. I'm sometime having errors popping in Bugsnag that say: unhandledrejection handler received a non-error. With that: no file, no stacktrace.
  3. the user actions to have this error is when going from one page to another, everytime the same origin and destination, but I can not reproduce in local or in production. I don't know if the user is blocked or if the error is silent to him
  4. I've tried to use https://github.com/grantila/trace-unhandled to log more informations, but the only things I get is:
UnhandledPromiseRejectionWarning
[ Stacktrace altered by https://github.com/grantila/trace-unhandled ]
Unknown error
    ==== Promise at: ==================


    ==== Error at: ====================


    ==== Shared trace: ================

But when creating my own unhandled rejected promise I can get something like that:

UnhandledPromiseRejectionWarning
[ Stacktrace altered by https://github.com/grantila/trace-unhandled ]
Unknown error
    ==== Promise at: ==================
    at eval (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/vuetify-loader/lib/loader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/pages/Customer/CurrentCases.vue?vue&type=script&lang=js&:127:9)
    at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/vuetify-loader/lib/loader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/pages/Customer/CurrentCases.vue?vue&type=script&lang=js& (http://....../js/23.js:23:1)
    at __webpack_require__ (http://....../js/app.js:790:30)
    at fn (http://....../js/app.js:151:20)
    at eval (webpack-internal:///./src/components/pages/Customer/CurrentCases.vue?vue&type=script&lang=js&:2:339)
    at Module../src/components/pages/Customer/CurrentCases.vue?vue&type=script&lang=js& (http://....../js/23.js:107:1)
    at __webpack_require__ (http://....../js/app.js:790:30)
    at fn (http://....../js/app.js:151:20)
    at eval (webpack-internal:///./src/components/pages/Customer/CurrentCases.vue:3:100)
    at Module../src/components/pages/Customer/CurrentCases.vue (http://....../js/23.js:95:1)
    at __webpack_require__ (http://....../js/app.js:790:30)
    at fn (http://....../js/app.js:151:20)

    ==== Error at: ====================


    ==== Shared trace: ================

So, my question is : What can I do to find more about the origin of an hundled promise rejection in browser ?

  • Look at all `reject` calls and `throw` statements to find the one where you use a value that's not an error object. A linter might help with this, especially if you're using typescript. – Bergi Jan 06 '21 at 19:34
  • Thanks @Bergi. I've already searched in our own codebase, I did not find anything like that. It might be in a dependency, but used dependencies are well tested : Apollo, vue... and I don't think I would be the only one to have that. BTW, we do not use Type Script :( – Rémi JANOT Jan 08 '21 at 09:40
  • I guess then you can only try littering your promise chains with ``.catch(e => { throw (e instanceof Error) ? e : new Error(`unknown ${e} at file x line y`); })`` – Bergi Jan 08 '21 at 09:47

0 Answers0