Open quinarygio opened 2 weeks ago
possible Workaround:
app.use(
/\/((?!healthcheck).)*/, // Token verification activated except for healthcheck request
async (req: any, res: any, next: NextFunction) => expressjwt({
secret: jwksRsa.expressJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri: jwksUri
}) as GetVerificationKey,
algorithms: ['RS256']
})(req, res, next) as Promise<void>
);
Background: middlewares are considered async now and Request, Response interfaces are a little bit different.
Thank you for the quick response, but unfortunately the workaround does not solve the issue, the compilation still fails:
error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(req: any, res: any, next: NextFunction) => Promise<void | NodeJS.Immediate>' is not assignable to parameter of type 'Application<Record<string, any>>'.
Type '(req: any, res: any, next: NextFunction) => Promise<void | Immediate>' is missing the following properties from type 'Application<Record<string, any>>': init, defaultConfiguration, engine, set, and 63 more.
@quinarygio do you have the as Promise<void>
in your code?
@quinarygio do you have the
as Promise<void>
in your code?
Sorry I was missing it, as I copied from the received email. It works now ! Thank you
Seems like the main-problem is, that it is wrapping calling next
with setImmediate
so the return type is not matching.
Add support for Express v5.0
After upgrading to express v5.0.0 the compilation fails with the following error: