Skip to content

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

Increase rrweb chunk limits

Blue Mousece046b8b55b0
diff --git a/backend/apps/cloud/src/analytics/analytics.service.ts b/backend/apps/cloud/src/analytics/analytics.service.ts
index 0dcc94ba3..6d20a4368 100644
--- a/backend/apps/cloud/src/analytics/analytics.service.ts
+++ b/backend/apps/cloud/src/analytics/analytics.service.ts
@@ -142,7 +142,7 @@ const MAX_FILTERS = 100
const MAX_FILTER_VALUES = 100
const SESSION_REPLAY_RETENTION_VALUES = [30, 90, 365, 1825] as const
const MAX_SESSION_REPLAY_EVENTS_PER_CHUNK = 1000
-const MAX_SESSION_REPLAY_CHUNK_BYTES = 900 * 1024
+const MAX_SESSION_REPLAY_CHUNK_BYTES = 15 * 1024 * 1024
const MAX_SESSION_REPLAY_CHUNKS_PER_REPLAY = 1200
const MAX_SESSION_REPLAY_EVENTS_PER_REPLAY = 100000
const MAX_SESSION_REPLAY_BYTES_PER_REPLAY = 150 * 1024 * 1024
diff --git a/backend/apps/cloud/src/main.ts b/backend/apps/cloud/src/main.ts
index f376827f5..56da45680 100644
--- a/backend/apps/cloud/src/main.ts
+++ b/backend/apps/cloud/src/main.ts
@@ -11,13 +11,30 @@ import { isDevelopment } from './common/constants'
import { AppModule } from './app.module'
import { validateLicense } from './common/license'
+const DEFAULT_JSON_BODY_LIMIT = '1mb'
+const SESSION_REPLAY_CHUNK_BODY_LIMIT = '15mb'
+const SESSION_REPLAY_CHUNK_PATHS = [
+ '/log/session-replay/chunk',
+ '/v1/log/session-replay/chunk',
+]
+
async function bootstrap() {
validateLicense()
- const app = await NestFactory.create<NestExpressApplication>(AppModule)
+ const app = await NestFactory.create<NestExpressApplication>(AppModule, {
+ bodyParser: false,
+ })
app.use(cookieParser())
- app.useBodyParser('json', { limit: '1mb' })
+ app.use(
+ SESSION_REPLAY_CHUNK_PATHS,
+ express.json({ limit: SESSION_REPLAY_CHUNK_BODY_LIMIT }),
+ )
+ app.useBodyParser('json', { limit: DEFAULT_JSON_BODY_LIMIT })
+ app.useBodyParser('urlencoded', {
+ extended: true,
+ limit: DEFAULT_JSON_BODY_LIMIT,
+ })
app.useGlobalPipes(new ValidationPipe())
app.enableVersioning({