Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

fix: unable to update integration when encryption key changed (#2133)

Meier Lukas93dc3ae97ed9
diff --git a/packages/api/package.json b/packages/api/package.json
index d025d004e..123e02a1d 100644
--- a/packages/api/package.json
+++ b/packages/api/package.json
@@ -45,6 +45,7 @@
"@trpc/server": "next",
"lodash.clonedeep": "^4.5.0",
"next": "15.1.6",
+ "pretty-print-error": "^1.1.2",
"react": "19.0.0",
"react-dom": "19.0.0",
"superjson": "2.2.2",
diff --git a/packages/api/src/router/integration/integration-test-connection.ts b/packages/api/src/router/integration/integration-test-connection.ts
index 58fcc9d21..db36ef568 100644
--- a/packages/api/src/router/integration/integration-test-connection.ts
+++ b/packages/api/src/router/integration/integration-test-connection.ts
@@ -1,8 +1,11 @@
+import { formatError } from "pretty-print-error";
+
import { decryptSecret } from "@homarr/common/server";
import type { Integration } from "@homarr/db/schema";
import type { IntegrationKind, IntegrationSecretKind } from "@homarr/definitions";
import { getAllSecretKindOptions } from "@homarr/definitions";
import { integrationCreator, IntegrationTestConnectionError } from "@homarr/integrations";
+import { logger } from "@homarr/log";
type FormIntegration = Integration & {
secrets: {
@@ -28,11 +31,22 @@ export const testConnectionAsync = async (
source: "form" as const,
}));
- const decryptedDbSecrets = dbSecrets.map((secret) => ({
- ...secret,
- value: decryptSecret(secret.value),
- source: "db" as const,
- }));
+ const decryptedDbSecrets = dbSecrets
+ .map((secret) => {
+ try {
+ return {
+ ...secret,
+ value: decryptSecret(secret.value),
+ source: "db" as const,
+ };
+ } catch (error) {
+ logger.warn(
+ `Failed to decrypt secret from database integration="${integration.name}" secretKind="${secret.kind}"\n${formatError(error)}`,
+ );
+ return null;
+ }
+ })
+ .filter((secret) => secret !== null);
const sourcedSecrets = [...formSecrets, ...decryptedDbSecrets];
const secretKinds = getSecretKindOption(integration.kind, sourcedSecrets);
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1a09a0a70..11b1e0242 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -578,6 +578,9 @@ importers:
next:
specifier: 15.1.6
+ pretty-print-error:
+ specifier: ^1.1.2
+ version: 1.1.2(patch_hash=4arrfgbz7em6s4gqywse7esg4u)
react:
specifier: 19.0.0
version: 19.0.0