upstash/ratelimit-js

Unable to view analytics on rate limit dashboard

getalihassan opened this issue · 8 comments

const rateLImit = new Ratelimit({
redis,
prefix: "@upstash/ratelimit",
limiter: Ratelimit.slidingWindow(10, "10 s"),
analytics: true,
})

const isAuthed = root.middleware(async ({ ctx, next }) => {
if (!ctx.auth.userId) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
const { success } = await rateLImit.limit(ctx.auth.userId);
if (!success) {
throw new TRPCError({ code: "TOO_MANY_REQUESTS" });
}
return next({
ctx: {
// infers the session as non-nullable
auth: ctx.auth,
},
});
});

export const protectedProcedure = root.procedure.use(isAuthed);

I am using protectedProcedure in my routers query as well as mutations in TRPC.

I can see other logs and usage dashaboard. but when I navigate to rate limit dashboard it is all empty even though I can trigger rate limit by sending multiple requests and servers does throw 429 (TOO Many Requests)

does it not support TRPC?

what I am doing wrong

did you select the correct db and prefix?
what version are you on?

Hi @chronark I am using latest version
"@upstash/ratelimit": "^0.4.3",
yes I selected the correct db (I only have one) and used the correct prefix

@chronark there's a bug in rate limit dashboard

when changing prefix you have to hit enter in the input field but this won't trigger reload. you have to manually reload the page
https://www.loom.com/share/87a2f0cc1ee64b5eaf002be8ee9d5078

thank you very much for the video, this is indeed a bug in the dashboard
I'll let the team know

everything else was working as expected, right?

@chronark yes thanks and it was great to see you guys are this much active and available to help

of course,
we don't want to ship broken things :)

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 30 days.

This issue was closed because it has been stalled for 30 days with no activity.