TypeError: Right-hand side of 'instanceof' is not an object

I am updating my app from 3.11 to 3.12. I had not this problem prior to updating.

When I try to login, I get this error

TypeError: Right-hand side of 'instanceof' is not an object

Following the stack trace, this happens in my application.js file, in that part.

error(error, transition) { if (error instanceof NotFoundError) { this.replaceWith('login'); return true; } if (error instanceof AdapterError) { if (get(this, 'session').get('isAuthenticated')) { get(this, 'session').invalidate(); } return true; }

They are imported like this, as shown in the doc here

In the top of my application.js file

import { NotFoundError } from '@ember-data/adapter/error'; import { AdapterError } from '@ember-data/adapter/error';

I can’t figure out what is wrong.

Here is the whole stack trace

TypeError: Right-hand side of 'instanceof' is not an object at Class.error (application.js:144) at Class.triggerEvent (router.js:1295) at PrivateRouter.triggerEvent (router.js:175) at Transition.trigger (router_js.js:464) at PrivateRouter.transitionDidError (router.js:197) at router_js.js:270 at invokeCallback (rsvp.js:490) at publish (rsvp.js:473) at publishRejection (rsvp.js:409) at rsvp.js:16

Anyone has an idea to fix that?

Thanks!

AdapterError is the default export of the error module, not a named export.

import AdapterError, { NotFoundError } from '@ember-data/adapter/error';

Thanks for your help, this seem to have fix it.

If you don’t mind me asking,

here’s how it was called in my working 3.11 version.

import { AdapterError, NotFoundError } from 'ember-data/adapters/errors';

This was working in 3.11 but no longer in 3.12.

Why is that?