diff --git a/.server-changes/fix-resume-user-paused-environment.md b/.server-changes/fix-resume-user-paused-environment.md new file mode 100644 index 0000000000..2be70288a1 --- /dev/null +++ b/.server-changes/fix-resume-user-paused-environment.md @@ -0,0 +1,6 @@ +--- +area: webapp +type: fix +--- + +Fixed manually paused environments not being resumable. Resuming incorrectly failed with a billing-limit error even when no billing limit was in effect. diff --git a/apps/webapp/app/v3/services/pauseEnvironment.server.ts b/apps/webapp/app/v3/services/pauseEnvironment.server.ts index 4311edbee3..4cafbac140 100644 --- a/apps/webapp/app/v3/services/pauseEnvironment.server.ts +++ b/apps/webapp/app/v3/services/pauseEnvironment.server.ts @@ -78,7 +78,12 @@ export class PauseEnvironmentService extends WithRunEngine { const resumed = await this._prisma.runtimeEnvironment.updateMany({ where: { id: environment.id, - NOT: { pauseSource: EnvironmentPauseSource.BILLING_LIMIT }, + // NOT on a nullable field excludes NULL rows in Prisma, which made + // user-paused envs (pauseSource null) unresumable. + OR: [ + { pauseSource: null }, + { NOT: { pauseSource: EnvironmentPauseSource.BILLING_LIMIT } }, + ], }, data: { paused: false,