tsed-getting-started icon indicating copy to clipboard operation
tsed-getting-started copied to clipboard

CustomerGEHMiddleware with @OverrideProvider does not work

Open jzingler-lp opened this issue 5 years ago • 3 comments

The CustomerGEHMiddleware is not enabled by default. When I do enable the CustomerGEHMiddleware by adding it to the Server.ts file it results in the following error.

Versions impacts: v5.46.0 to v5.59.4 (did not test versions less than v5.46.0)

 error: {
    status: 500,
    message: "Class constructor CustomerGEHMiddleware cannot be invoked without 'new'",
    stack: 'TypeError: Class constructor CustomerGEHMiddleware cannot be invoked ' +
      "without 'new'\n    at Layer.handle [as handle_request] " +

jzingler-lp avatar Jul 08 '20 22:07 jzingler-lp

Hello @jzingler-lp I fixed the example :)

See you Romain

Romakita avatar Jul 09 '20 08:07 Romakita

Thanks @Romakita, so did you just remove the @OverrideProvider all together?

jzingler-lp avatar Jul 09 '20 16:07 jzingler-lp

Yes. Isn’t required to override the original provider since you can register it in the server before the original one. Override a provider can be problematic when you upgrade Ts.ED packages :)

This solution is more robust :)

Romakita avatar Jul 09 '20 18:07 Romakita