Skip to content

Commit dbfca1b

Browse files
committed
Don't allow resuming if runsEnabled is false
1 parent 644c1ef commit dbfca1b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

apps/webapp/app/v3/services/pauseEnvironment.server.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@ export class PauseEnvironmentService extends WithRunEngine {
2727
action: PauseStatus
2828
): Promise<PauseEnvironmentResult> {
2929
try {
30+
const org = await this._prisma.organization.findFirst({
31+
where: {
32+
id: environment.organizationId,
33+
},
34+
select: {
35+
runsEnabled: true,
36+
},
37+
});
38+
39+
if (!org) {
40+
throw new Error("Organization not found");
41+
}
42+
43+
if (!org.runsEnabled && action === "resumed") {
44+
throw new Error(
45+
"Runs are disabled for this organization. Your free plan has probably been exceeded. If not please contact support."
46+
);
47+
}
48+
3049
await this._prisma.runtimeEnvironment.update({
3150
where: {
3251
id: environment.id,

0 commit comments

Comments
 (0)