0

So, I encountered a production only bug in my Angular Meteor app with the following code:

export class NavComponent extends FacebookLoginPartial {
    constructor(router : Router) {
        super(router);
    }
}

export class FacebookLoginPartial {      
    constructor(protected router : Router) {}

    ...
}

The error is Error: Can't resolve all parameters for t and the application fails completely. As I mentioned, this only occurs in production (that is deploying with meteor deploy --debug or locally with meteor --production). I realise this is probably a failure in my understanding of dependency injection but I don't know quite what has gone wrong or why it only fails in prod.

Anyway, I fixed it by doing the following instead:

export class NavComponent extends FacebookLoginPartial {
    constructor(protected router : Router) {
        super();
    }
}

export class FacebookLoginPartial {    
    protected router : Router;

    constructor() {}

    ...
}

For what it's worth here is the full stack:

"Error: Can't resolve all parameters for t: (?).
    at d (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:22:12329)
    at e [as constructor] (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:25:10456)
    at new e (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:25:12091)
    at t._getDependenciesMetadata (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:31:3954)
    at t._getTypeMetadata (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:31:2296)
    at t.getNonNormalizedDirectiveMetadata (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:30:28066)
    at t._loadDirectiveMetadata (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:30:25758)
    at http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:30:29255
    at Array.forEach (native)
    at t.loadNgModuleDirectiveAndPipeMetadata (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:30:29227)
    at http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:34:9473
    at Array.forEach (native)
    at t._loadModules (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:34:9426)
    at t._compileModuleAndComponents (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:34:8904)
    at t.compileModuleAsync (http://localhost:3000/0effe9726410827977b94b8d72efd44b2919c3e6.js?meteor_js_resource=true:34:8342)"
Kim Kern
  • 54,283
  • 17
  • 197
  • 195
Harry
  • 336
  • 1
  • 11
  • 1
    Check this answer http://stackoverflow.com/questions/37997824/angular-2-di-error-exception-cant-resolve-all-parameters – Aravind Sivam Mar 31 '17 at 11:48
  • Thanks @AravindSivam, this sounds pretty similar to the issue I'm having, I'll do a little reading around this and see if I can figure it out. – Harry Mar 31 '17 at 12:10

0 Answers0