CognxSafeTrack commited on
Commit
d11ce48
Β·
1 Parent(s): a7a1900

fix(types): remove per-route rateLimit config and fix content-type parser done() types

Browse files
Files changed (1) hide show
  1. apps/api/src/routes/whatsapp.ts +2 -10
apps/api/src/routes/whatsapp.ts CHANGED
@@ -53,7 +53,7 @@ export async function whatsappRoutes(fastify: FastifyInstance) {
53
  try {
54
  done(null, JSON.parse(body.toString('utf8')));
55
  } catch (err: any) {
56
- done(err, undefined);
57
  }
58
  });
59
 
@@ -80,15 +80,7 @@ export async function whatsappRoutes(fastify: FastifyInstance) {
80
  });
81
 
82
  // ── POST /webhook β€” Incoming Meta events ────────────────────────────────
83
- fastify.post('/webhook', {
84
- config: {
85
- // Rate limit: max 200 requests per minute (per IP) for this route
86
- rateLimit: {
87
- max: 200,
88
- timeWindow: '1 minute',
89
- },
90
- },
91
- }, async (request, reply) => {
92
  // ── 1. HMAC Signature Verification ──────────────────────────────────
93
  const appSecret = process.env.WHATSAPP_APP_SECRET;
94
 
 
53
  try {
54
  done(null, JSON.parse(body.toString('utf8')));
55
  } catch (err: any) {
56
+ done(err as Error, undefined as unknown as Buffer);
57
  }
58
  });
59
 
 
80
  });
81
 
82
  // ── POST /webhook β€” Incoming Meta events ────────────────────────────────
83
+ fastify.post('/webhook', async (request, reply) => {
 
 
 
 
 
 
 
 
84
  // ── 1. HMAC Signature Verification ──────────────────────────────────
85
  const appSecret = process.env.WHATSAPP_APP_SECRET;
86