Skip to content

Commit 154a6a8

Browse files
committed
fix(instantly): guard against empty patch_lead request body
Follows the same pattern used in tools/langsmith/update_run.ts.
1 parent 99d0dc1 commit 154a6a8

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

apps/sim/tools/instantly/patch_lead.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ export const patchLeadTool: ToolConfig<InstantlyPatchLeadParams, InstantlyLeadRe
9494
url: (params) => instantlyUrl(`/api/v2/leads/${params.leadId.trim()}`),
9595
method: 'PATCH',
9696
headers: instantlyHeaders,
97-
body: (params) =>
98-
compactBody({
97+
body: (params) => {
98+
const body = compactBody({
9999
first_name: params.first_name,
100100
last_name: params.last_name,
101101
company_name: params.company_name,
@@ -107,7 +107,14 @@ export const patchLeadTool: ToolConfig<InstantlyPatchLeadParams, InstantlyLeadRe
107107
pl_value_lead: params.pl_value_lead,
108108
assigned_to: params.assigned_to,
109109
custom_variables: params.custom_variables,
110-
}),
110+
})
111+
112+
if (Object.keys(body).length === 0) {
113+
throw new Error('Provide at least one field to update')
114+
}
115+
116+
return body
117+
},
111118
},
112119
transformResponse: async (response) => {
113120
const data = await parseInstantlyResponse(response)

0 commit comments

Comments
 (0)