Files
calendar/apps/api/v1/lib/helpers/captureUserId.ts
T
Omar LópezandGitHub 19712f62e3 feat: improved observability on api v1 and webapp (#20302)
* feat: associate errors to users on api v1

* Added webapp

* Update layout.tsx

* Update captureUserId.ts
2025-03-24 23:01:20 +00:00

9 lines
265 B
TypeScript

import { setUser as SentrySetUser } from "@sentry/nextjs";
import type { NextMiddleware } from "next-api-middleware";
export const captureUserId: NextMiddleware = async (req, res, next) => {
if (req.userId) SentrySetUser({ id: req.userId });
await next();
};