diff --git a/package.json b/package.json index 151caf864..0a1c624b1 100644 --- a/package.json +++ b/package.json @@ -45,5 +45,10 @@ "packageManager": "pnpm@9.14.4", "engines": { "node": ">=22.12.0" + }, + "pnpm": { + "patchedDependencies": { + "pretty-print-error": "patches/pretty-print-error.patch" + } } } diff --git a/packages/request-handler/package.json b/packages/request-handler/package.json index 1bff8430b..ff9ba3a60 100644 --- a/packages/request-handler/package.json +++ b/packages/request-handler/package.json @@ -29,6 +29,7 @@ "@homarr/log": "workspace:^0.1.0", "@homarr/redis": "workspace:^0.1.0", "dayjs": "^1.11.13", + "pretty-print-error": "^1.1.2", "superjson": "2.2.1" }, "devDependencies": { diff --git a/packages/request-handler/src/lib/cached-request-integration-job-handler.ts b/packages/request-handler/src/lib/cached-request-integration-job-handler.ts index 85bbd78f8..c9e2efe9a 100644 --- a/packages/request-handler/src/lib/cached-request-integration-job-handler.ts +++ b/packages/request-handler/src/lib/cached-request-integration-job-handler.ts @@ -1,3 +1,4 @@ +import { formatError } from "pretty-print-error"; import SuperJSON from "superjson"; import { hashObjectBase64, Stopwatch } from "@homarr/common"; @@ -95,7 +96,7 @@ export const createRequestIntegrationJobHandler = < ); } catch (error) { logger.error( - `Failed to run integration job integration=${integrationId} inputHash='${inputHash}' error=${error as string}`, + `Failed to run integration job integration=${integrationId} inputHash='${inputHash}' error=${formatError(error)}`, ); } } diff --git a/patches/pretty-print-error.patch b/patches/pretty-print-error.patch new file mode 100644 index 000000000..c61cb16b5 --- /dev/null +++ b/patches/pretty-print-error.patch @@ -0,0 +1,16 @@ +diff --git a/src/index.ts b/src/index.ts +index c8f62a743b89040c1d10a8ae3795bec8afcbc134..7cd7c1e98c1c9516b40f678627f51fd1adfa18c7 100644 +--- a/src/index.ts ++++ b/src/index.ts +@@ -109,9 +109,9 @@ export function formatError( + (name) => name !== "stack" && name !== "message" + ); + if (propNames.length > 0) { +- const props = {}; ++ const props: Record = {}; + propNames.forEach((name) => { +- props[name] = err[name]; ++ props[name] = (err as Record)[name]; + }); + + let propertiesString; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d13676662..5ff24173b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +patchedDependencies: + pretty-print-error: + hash: 4arrfgbz7em6s4gqywse7esg4u + path: patches/pretty-print-error.patch + importers: .: @@ -1341,6 +1346,9 @@ importers: dayjs: specifier: ^1.11.13 version: 1.11.13 + pretty-print-error: + specifier: ^1.1.2 + version: 1.1.2(patch_hash=4arrfgbz7em6s4gqywse7esg4u) superjson: specifier: 2.2.1 version: 2.2.1 @@ -6768,6 +6776,9 @@ packages: resolution: {integrity: sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==} engines: {node: '>=14.16'} + pretty-print-error@1.1.2: + resolution: {integrity: sha512-XkKN3W8aeRYApO17WpzuaJZmqH3WNSFeqR4Sxt7vu+C7pcWB+3+JDJ2dnnhzSCqvC1IaYR36CVh4VsFZyBicQA==} + prismjs@1.27.0: resolution: {integrity: sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA==} engines: {node: '>=6'} @@ -13667,6 +13678,10 @@ snapshots: dependencies: parse-ms: 3.0.0 + pretty-print-error@1.1.2(patch_hash=4arrfgbz7em6s4gqywse7esg4u): + dependencies: + kleur: 4.1.5 + prismjs@1.27.0: {} prismjs@1.29.0: {}