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
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 |
|