Skip to content
This repository has been archived by the owner on Nov 23, 2022. It is now read-only.

Rate limit exceeded in first request #93

Open
abdollahzadehAli opened this issue Apr 4, 2022 · 0 comments
Open

Rate limit exceeded in first request #93

abdollahzadehAli opened this issue Apr 4, 2022 · 0 comments

Comments

@abdollahzadehAli
Copy link

abdollahzadehAli commented Apr 4, 2022

hi this is my app.module
@global()
@module({
imports: [
RateLimiterModule.register(rateLimiterConfig),
],
providers: [{ provide: APP_GUARD, useClass: RateLimiterGuard }],

and this is my config file
import { createConnection } from 'typeorm';
const connection = createConnection({
type: 'postgres',
host: process.env.DATABASE_HOST || 'localhost',
port: Number(process.env.DATABASE_PORT) || 5432,
username: process.env.DATABASE_USERNAME || 'postgres',
password: process.env.DATABASE_PASSWORD || 'postgres',
database: process.env.DATABASE_NAME,
});

export const rateLimiterConfig: RateLimiterOptions = {
for: 'Express',
type: 'Postgres',
keyPrefix: 'global',
points: 10,
pointsConsumed: 1,
duration: 60,
blockDuration: 3600,
whiteList: [],
blackList: [],
storeClient: connection,
dbName: 'test,
tableName: 'rate_limiter',
clearExpiredByTimeout: false,
errorMessage: 'Rate limit exceeded',
};

i'm sure that my connection information is right it even create the table and record when i send request but i get Rate limit exceeded in first request but if i use Memory it works just fine. how can i fix this?
thx in advance and sorry for my bad eng

@abdollahzadehAli abdollahzadehAli changed the title Rate limit exceeded in first request and saving ip from request Rate limit exceeded in first request Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant