@@ -73,7 +73,7 @@ export class WorkerGroupTokenService extends WithRunEngine {
73
73
}
74
74
75
75
async rotateToken ( { workerGroupId } : { workerGroupId : string } ) {
76
- const workerGroup = await this . _prisma . workerInstanceGroup . findUnique ( {
76
+ const workerGroup = await this . _prisma . workerInstanceGroup . findFirst ( {
77
77
where : {
78
78
id : workerGroupId ,
79
79
} ,
@@ -266,12 +266,10 @@ export class WorkerGroupTokenService extends WithRunEngine {
266
266
return await $transaction ( this . _prisma , async ( tx ) => {
267
267
const resourceIdentifier = deploymentId ? `${ deploymentId } :${ instanceName } ` : instanceName ;
268
268
269
- const workerInstance = await tx . workerInstance . findUnique ( {
269
+ const workerInstance = await tx . workerInstance . findFirst ( {
270
270
where : {
271
- workerGroupId_resourceIdentifier : {
272
- workerGroupId : workerGroup . id ,
273
- resourceIdentifier,
274
- } ,
271
+ workerGroupId : workerGroup . id ,
272
+ resourceIdentifier,
275
273
} ,
276
274
include : {
277
275
deployment : true ,
@@ -315,12 +313,10 @@ export class WorkerGroupTokenService extends WithRunEngine {
315
313
// Unique constraint violation
316
314
if ( error . code === "P2002" ) {
317
315
try {
318
- const existingWorkerInstance = await tx . workerInstance . findUnique ( {
316
+ const existingWorkerInstance = await tx . workerInstance . findFirst ( {
319
317
where : {
320
- workerGroupId_resourceIdentifier : {
321
- workerGroupId : workerGroup . id ,
322
- resourceIdentifier,
323
- } ,
318
+ workerGroupId : workerGroup . id ,
319
+ resourceIdentifier,
324
320
} ,
325
321
include : {
326
322
deployment : true ,
@@ -363,7 +359,7 @@ export class WorkerGroupTokenService extends WithRunEngine {
363
359
364
360
// Unmanaged workers instances are locked to a specific deployment version
365
361
366
- const deployment = await tx . workerDeployment . findUnique ( {
362
+ const deployment = await tx . workerDeployment . findFirst ( {
367
363
where : {
368
364
...( deploymentId . startsWith ( "deployment_" )
369
365
? {
@@ -690,7 +686,7 @@ export class AuthenticatedWorkerInstance extends WithRunEngine {
690
686
691
687
const environment =
692
688
this . environment ??
693
- ( await this . _prisma . runtimeEnvironment . findUnique ( {
689
+ ( await this . _prisma . runtimeEnvironment . findFirst ( {
694
690
where : {
695
691
id : engineResult . execution . environment . id ,
696
692
} ,
0 commit comments