Jblew / firebase-functions-rate-limiter

Js/ts library that allows you to set per-time, per-user or per-anything limits for calling Firebase cloud functions
MIT License
100 stars 15 forks source link

building from src TS #34

Closed riksnelders closed 2 years ago

riksnelders commented 2 years ago

Getting errors when building whenever I import FirebaseFunctionsRateLimiter.

Any ideas?

code I use

export const rateLimiter =  async  (req: Request, res: Response, next: NextFunction) => {
    const someLimiter =   FirebaseFunctionsRateLimiter.withRealtimeDbBackend(
        {
            name: "limiter_some",
            maxCalls: 10,
            periodSeconds: 60,
        },
        admin.database(),
    );
    const qualifier = "u_" + req.app.locals.user.uid;
    const quotaExceeded = await someLimiter.isQuotaExceededOrRecordUsage(qualifier);
    if (quotaExceeded) {
        // respond with error
        res.send("error")
    } else {
        next()

    }
};

Error i get from TS image

theTechGoose commented 2 years ago

Bump, same issue.

Jblew commented 2 years ago

@riksnelders @Rofer11607 it should be resolved now :) Sorry for soo long waiting (I become a doctor in the meanwhile xD)