Nest: v5 -> v6: TypeError: metatype is not a constructor

Created on 14 Jun 2019  路  2Comments  路  Source: nestjs/nest

Regression

While upgrading a sizable Nest 5 application to version, I get this error:
TypeError: metatype is not a constructor

Thrown in line 274 at injector.js, all i can get from debugging is that is seems to be an anonymous function:
(...args) => { let n = args[0] || defaultKey; if (n in cache) { return cache[n]; } else { let result = fn(n === defaultKey ? undefined : n); cache[n] = result; return result; } }

Describe the regression

Works in v5, not in v6

Expected behavior/code

To either work or give some indication of what / why / where the problem exists. I get no context at all.

Environment


Nest version: 5.4.0 -> 6.3.1

For Tooling issues:
- Node version: 10  
- Platform:  Linux 

Others:

needs triage type

Most helpful comment

The problem was @UseGuards(AuthGuard) at one point in my code, which should have been @UseGuards(AuthGuard('bearer'))

I really wish the injector could give a little more context and not just the standard js error.

All 2 comments

The problem was @UseGuards(AuthGuard) at one point in my code, which should have been @UseGuards(AuthGuard('bearer'))

I really wish the injector could give a little more context and not just the standard js error.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

2233322 picture 2233322  路  3Comments

KamGor picture KamGor  路  3Comments

breitsmiley picture breitsmiley  路  3Comments

hackboy picture hackboy  路  3Comments

mishelashala picture mishelashala  路  3Comments