diff --git a/packages/runner/lib/exec.ts b/packages/runner/lib/exec.ts index 606278218f9..d5b0b1e6bfe 100644 --- a/packages/runner/lib/exec.ts +++ b/packages/runner/lib/exec.ts @@ -200,10 +200,12 @@ export async function exec( type: 'script_http_error', payload: truncateJson(typeof errorResponse === 'string' ? { message: errorResponse } : errorResponse), status: err.response.status, - upstream_response: { - status: err.response.status, - headers, - body: truncateJson(typeof errorResponse === 'string' ? { message: errorResponse } : errorResponse) + additional_properties: { + upstream_response: { + status: err.response.status, + headers, + body: truncateJson(typeof errorResponse === 'string' ? { message: errorResponse } : errorResponse) + } } }, response: null diff --git a/packages/runner/lib/exec.unit.test.ts b/packages/runner/lib/exec.unit.test.ts index da05244bd1a..3a300738e58 100644 --- a/packages/runner/lib/exec.unit.test.ts +++ b/packages/runner/lib/exec.unit.test.ts @@ -186,15 +186,17 @@ describe('Exec', () => { error: 'Not found' }, status: 404, - upstream_response: { - body: { - error: 'Not found' - }, - headers: { - 'content-type': 'application/json', - 'x-ratelimit-limit': '100' - }, - status: 404 + additional_properties: { + upstream_response: { + body: { + error: 'Not found' + }, + headers: { + 'content-type': 'application/json', + 'x-ratelimit-limit': '100' + }, + status: 404 + } }, type: 'script_http_error' }); diff --git a/packages/shared/lib/utils/error.ts b/packages/shared/lib/utils/error.ts index d32220264e2..54aff0d5d4e 100644 --- a/packages/shared/lib/utils/error.ts +++ b/packages/shared/lib/utils/error.ts @@ -5,15 +5,15 @@ export class NangoError extends Error { public readonly status: number = 500; public readonly type: string; public payload: Record; - public additionalProperties: JsonValue = {}; + public additional_properties: JsonValue = {}; public override readonly message: string; - constructor(type: string, payload = {}, status?: number, additionalProperties: JsonValue = {}) { + constructor(type: string, payload = {}, status?: number, additional_properties: JsonValue = {}) { super(); this.type = type; this.payload = payload; - this.additionalProperties = additionalProperties; + this.additional_properties = additional_properties; if (status) { this.status = status; @@ -525,7 +525,7 @@ export function isNangoErrorAsJson(obj: unknown): obj is NangoError { export function deserializeNangoError(err: unknown): NangoError | null { if (isNangoErrorAsJson(err)) { - return new NangoError(err['type'], err.payload, err.status); + return new NangoError(err['type'], err.payload, err.status, err.additional_properties); } return null; } diff --git a/packages/types/lib/runner/index.ts b/packages/types/lib/runner/index.ts index 546dd172bab..a171b4898b4 100644 --- a/packages/types/lib/runner/index.ts +++ b/packages/types/lib/runner/index.ts @@ -2,7 +2,11 @@ export interface RunnerOutputError { type: string; payload: Record | unknown[]; status: number; - upstream_response?: RunnerUpstreamResponse | undefined; + additional_properties?: + | { + upstream_response?: RunnerUpstreamResponse | undefined; + } + | undefined; } export interface RunnerUpstreamResponse { diff --git a/vite.config.ts b/vite.config.ts index eac1fd44891..7e26ce7e7d2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -13,7 +13,8 @@ export default defineConfig({ NANGO_LOGS_ES_URL: 'http://fake.com', NANGO_LOGS_ES_USER: '', NANGO_LOGS_ES_PWD: '', - NANGO_LOGS_ENABLED: 'false' + NANGO_LOGS_ENABLED: 'false', + NANGO_DB_NAME: 'nango_test' }, chaiConfig: { truncateThreshold: 10000