mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix(server): set reqeust-id on ClsModule setup (#9829)
This commit is contained in:
@@ -10,6 +10,7 @@ import { ScheduleModule } from '@nestjs/schedule';
|
||||
import { ClsPluginTransactional } from '@nestjs-cls/transactional';
|
||||
import { TransactionalAdapterPrisma } from '@nestjs-cls/transactional-adapter-prisma';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { Response } from 'express';
|
||||
import { get } from 'lodash-es';
|
||||
import { ClsModule } from 'nestjs-cls';
|
||||
|
||||
@@ -57,6 +58,9 @@ export const FunctionalityModules = [
|
||||
// make every request has a unique id to tracing
|
||||
return randomUUID();
|
||||
},
|
||||
setup(cls, _req, res: Response) {
|
||||
res.setHeader('X-Request-Id', cls.getId());
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
// https://papooch.github.io/nestjs-cls/plugins/available-plugins/transactional/prisma-adapter
|
||||
|
||||
Reference in New Issue
Block a user