Skip to content

Commit cb2004b

Browse files
committed
fix(cloudflare): pass through structured array/object values as-is
A block-referenced array/object value was being blindly stringified before the JSON-shape check, so String([...]) comma-joined arrays and String({...}) produced the literal "[object Object]" instead of the JSON shape Cloudflare expects (e.g. for ciphers). Already-structured values now pass straight through.
1 parent ac807e6 commit cb2004b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

apps/sim/tools/cloudflare/update_zone_setting.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ export const updateZoneSettingTool: ToolConfig<
5252
'Content-Type': 'application/json',
5353
}),
5454
body: (params) => {
55-
// Wand-generated or block-reference values can arrive as a non-string
55+
// A block reference can pass an already-structured array/object straight
56+
// through despite the declared string param type — send it as-is rather
57+
// than stringifying it (String([...]) comma-joins, String({...}) yields
58+
// "[object Object]", neither of which is the JSON shape Cloudflare expects).
59+
if (params.value !== null && typeof params.value === 'object') {
60+
return { value: params.value }
61+
}
62+
63+
// Wand-generated values can also arrive as a non-string primitive
5664
// (e.g. a number, or null/undefined) at runtime despite the declared
5765
// param type — coerce null/undefined to '' rather than the literal
5866
// "null"/"undefined" strings String() would otherwise produce.

0 commit comments

Comments
 (0)