📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
parsing body as raw
Blue Mousedf83e09112c7
diff --git a/package.json b/package.jsonindex f61894a6c..13c584cfd 100644--- a/package.json+++ b/package.json@@ -33,6 +33,7 @@"@nestjs/typeorm": "^7.1.5","bcrypt": "^5.0.1","blake3": "^2.1.4",+ "body-parser": "^1.19.0","class-transformer": "^0.4.0","class-validator": "^0.13.1","clickhouse": "^2.4.0",diff --git a/src/main.ts b/src/main.tsindex 8136e1ad2..0d705bbf4 100644--- a/src/main.ts+++ b/src/main.ts@@ -2,6 +2,7 @@ import { NestFactory } from '@nestjs/core'// import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'import { ValidationPipe } from '@nestjs/common'import * as cookieParser from 'cookie-parser'+import * as bodyParser from 'body-parser'import { AppModule } from './app.module'@@ -20,6 +21,7 @@ async function bootstrap() {// const document = SwaggerModule.createDocument(app, options)// SwaggerModule.setup('', app, document)+ app.use('/webhook', bodyParser.raw({ type: 'application/json' }))await app.listen(5005)}bootstrap()diff --git a/src/webhook/webhook.controller.ts b/src/webhook/webhook.controller.tsindex a188544e8..f8cec3de1 100644--- a/src/webhook/webhook.controller.ts+++ b/src/webhook/webhook.controller.ts@@ -17,7 +17,7 @@ export class WebhookController {) { }@Post('/')- async logCustom(@Body() body: object, @Headers() headers): Promise<any> {+ async logCustom(@Body() body: Buffer, @Headers() headers): Promise<any> {this.logger.log({ body, headers }, 'POST /webhook')let event