diff --git a/src/@shared/src/auth/index.ts b/src/@shared/src/auth/index.ts index 6a80b8a..c41aa26 100644 --- a/src/@shared/src/auth/index.ts +++ b/src/@shared/src/auth/index.ts @@ -31,7 +31,8 @@ declare module "fastify" { export const Otp = OTP; let jwtAdded = false; export const jwtPlugin = fp(async (fastify, _opts) => { - if (jwtAdded) jwtAdded = true; + if (jwtAdded) return; + jwtAdded = true; let env = process.env.JWT_SECRET; if (isNullish(env)) throw "JWT_SECRET is not defined"; if (!fastify.hasDecorator("signJwt")) {