Skip to content

Commit 240ea1b

Browse files
committed
findUnique -> findFirst to stop the prisma dataloader issue on api key auth
1 parent 580f5ec commit 240ea1b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

apps/webapp/app/models/runtimeEnvironment.server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getUsername } from "~/utils/username";
55
export type { RuntimeEnvironment };
66

77
export async function findEnvironmentByApiKey(apiKey: string) {
8-
const environment = await prisma.runtimeEnvironment.findUnique({
8+
const environment = await prisma.runtimeEnvironment.findFirst({
99
where: {
1010
apiKey,
1111
},
@@ -25,7 +25,7 @@ export async function findEnvironmentByApiKey(apiKey: string) {
2525
}
2626

2727
export async function findEnvironmentByPublicApiKey(apiKey: string) {
28-
const environment = await prisma.runtimeEnvironment.findUnique({
28+
const environment = await prisma.runtimeEnvironment.findFirst({
2929
where: {
3030
pkApiKey: apiKey,
3131
},
@@ -45,7 +45,7 @@ export async function findEnvironmentByPublicApiKey(apiKey: string) {
4545
}
4646

4747
export async function findEnvironmentById(id: string) {
48-
const environment = await prisma.runtimeEnvironment.findUnique({
48+
const environment = await prisma.runtimeEnvironment.findFirst({
4949
where: {
5050
id,
5151
},
@@ -85,7 +85,7 @@ export async function createNewSession(environment: RuntimeEnvironment, ipAddres
8585
}
8686

8787
export async function disconnectSession(environmentId: string) {
88-
const environment = await prisma.runtimeEnvironment.findUnique({
88+
const environment = await prisma.runtimeEnvironment.findFirst({
8989
where: {
9090
id: environmentId,
9191
},

0 commit comments

Comments
 (0)