lukeautry / tsoa

Build OpenAPI-compliant REST APIs using TypeScript and Node
MIT License
3.54k stars 499 forks source link

Workaround - tsoa 5 - @Middlewares decorator - middlewares not called #1470

Closed netofri closed 12 months ago

netofri commented 1 year ago

Since upgrading to tsoa5, none of the middlewares added using the @Middlewares decorator are getting called. This can happen in a certain machine, while in another machine not.

Sorting

Possible Solution

Instead of import { Middlewares } from "tsoa";

Use import { Middlewares } from "@tsoa/runtime";

This has worked for me. I do not know the underlying issue. I think it has to do with the Reflect.getMetadata function, in the middlewares.js file, that in some machines returns undefined, which breaks all of the middlewares, and in others it returns a value, which works.

github-actions[bot] commented 1 year ago

Hello there netofri 👋

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.👀

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

WoH commented 1 year ago

Are you using a bundler? Did you import 'reflect-metadata'?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days