TypeError: Cannot read property 'router' of undefined

See original GitHub issue

Hello, I just had this error while trying to configure my engine. I just have one route in my addon:

import buildRoutes from 'ember-engines/routes';

export default buildRoutes(function() {
  this.route('myRoute');
});

In my app/router.js

this.mount('myAddon');

I received this error, when I tried to access to this route via _http://localhost:4200/myAddon/myRoute_:

TypeError: Cannot read property 'router' of undefined
  at error (router.js:827)
    at Router$1.triggerEvent (router.js:1006)
    at trigger (router.js:111)
    at Transition.trigger (router.js:645)
    at router.js:456
    at tryCatch (rsvp.js:429)
    at invokeCallback (rsvp.js:444)
    at publish (rsvp.js:412)
    at publishRejection (rsvp.js:347)
    at rsvp.js:14

Maybe somebody already faced this error, I couldn find any information on SO or github, but maybe I missed something!

If you need more information, please ask me! Good day to you!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
webhivecommented, Oct 20, 2017

Just done some research. Issue appear when adding ember-simple-auth addon. Prepared test project to reproduce an issue. You can download it here https://www.dropbox.com/s/ikjlltvw40sr4oi/bug_test.tar.gz?dl=0 Engines route protected with ember-simple-auth mixin and it caused an issue. To see it go to http://localhost:4200/blog/ Engine’s route without simeple auth mixin work well.

May be issue not in engines, but in simple-auth. But I hope at least you can check it and give a reasonable reply or may be point me what I am doing wrong.

1reaction
rwjbluecommented, Sep 13, 2017

I submitted https://github.com/emberjs/ember.js/pull/15665 to address the specific issue reported here (the 'router' of undefined error).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'router' of undefined · Issue #380 - GitHub
Hi, I have an issue with routing when i want to use the stateService to navigate. In the project i use version 0.8.9....
Read more >
Cannot read property '$router' of undefined? - Stack Overflow
I'm trying make so that users can login to page, but is showing me this massage "Cannot read property '$router' of undefined".
Read more >
typeerror: cannot read properties of undefined (reading 'router')
Here's an example of a JavaScript TypeError: Cannot read property of undefined thrown when a property is attempted to be read on an...
Read more >
Cannot read properties of undefined (reading 'pathname')
The error "Cannot read properties of undefined (reading 'pathname')" occurs when we don't set the to prop on a Link component in React...
Read more >
getting "TypeError: Cannot read property 'quote' of undefined ...
const express = require('express'); const { process_params } = require('express/lib/router'); const app = express(); const records ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found