Skip to content

Commit b39658b

Browse files
committed
fix: sentry memory leak by disabling includeLocalVariables
1 parent ed07bf9 commit b39658b

File tree

6 files changed

+932
-52
lines changed

6 files changed

+932
-52
lines changed

apps/webapp/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ build-storybook.log
1818
storybook-static
1919

2020
/prisma/seed.js
21-
/prisma/populate.js
21+
/prisma/populate.js
22+
.memory-snapshots

apps/webapp/app/routes/admin.api.v1.snapshot.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import os from "os";
44
import path from "path";
55
import { PassThrough } from "stream";
66
import v8 from "v8";
7-
import { requireUser } from "~/services/session.server";
7+
import { prisma } from "~/db.server";
8+
import { authenticateApiRequestWithPersonalAccessToken } from "~/services/personalAccessToken.server";
89

910
// Format date as yyyy-MM-dd HH_mm_ss_SSS
1011
function formatDate(date: Date) {
@@ -24,9 +25,19 @@ function formatDate(date: Date) {
2425
}
2526

2627
export async function loader({ request }: DataFunctionArgs) {
27-
const user = await requireUser(request);
28+
const authenticationResult = await authenticateApiRequestWithPersonalAccessToken(request);
2829

29-
if (!user.admin) {
30+
if (!authenticationResult) {
31+
throw new Response("You must be an admin to perform this action", { status: 403 });
32+
}
33+
34+
const user = await prisma.user.findFirst({
35+
where: {
36+
id: authenticationResult.userId,
37+
},
38+
});
39+
40+
if (!user?.admin) {
3041
throw new Response("You must be an admin to perform this action", { status: 403 });
3142
}
3243

0 commit comments

Comments
 (0)