deleting a secret provider warns which stacks it unbinds
This commit is contained in:
9 files changed
+186
-10
No files matched your search
@@ -8,7 +8,8 @@ import {
|
||||
createGitRepository,
|
||||
upsertStackSource,
|
||||
setStackEnvVars,
|
||||
getStackSource
|
||||
getStackSource,
|
||||
secretProviderExists
|
||||
} from '$lib/server/db';
|
||||
import { deployGitStack } from '$lib/server/git';
|
||||
import { authorize } from '$lib/server/authorize';
|
||||
@@ -98,6 +99,13 @@ export const POST: RequestHandler = async (event) => {
|
||||
return json({ error: 'Permission denied: binding a secret provider requires the secrets permission' }, { status: 403 });
|
||||
}
|
||||
|
||||
// A stale provider id (e.g. the provider was deleted/recreated while the editor
|
||||
// held the old list) would otherwise hit a raw foreign-key error on save. Reject
|
||||
// it cleanly so the user knows to reselect a provider (#1522).
|
||||
if (typeof data.secretProviderId === 'number' && !(await secretProviderExists(data.secretProviderId))) {
|
||||
return json({ error: 'The selected secret provider no longer exists. Reopen the stack and pick a current provider.' }, { status: 400 });
|
||||
}
|
||||
|
||||
// Check for name conflicts with existing stacks (regular/external/git)
|
||||
const existing = await getStackSource(trimmedStackName, data.environmentId || null);
|
||||
if (existing) {
|
||||
|
||||
Reference in new issue
Block a user