diff --git a/index.js b/index.js index af4f2eb..e32f96a 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ app.use( next(); }, rateLimit({ windowMs: 60_000, max: 10, - handler: (req, res, next, opts) => !req.user.admin ? res.error(opts.statusCode, "You are begin ratelimited") : next() + handler: (req, res, next, opts) => !req.user?.admin ? res.error(opts.statusCode, "You are begin ratelimited") : next() }), bodyParser.urlencoded({ extended: true }) );