Description
In sdk/js/src/providers/volcengine.ts, both createSandbox and listSandboxes explicitly map user-supplied camelCase fields to PascalCase body keys (following Volcengine API conventions), then spread ...kwargs[0] on top of the mapping. The spread re-adds the original camelCase keys, producing a JSON body that contains both PascalCase and camelCase duplicates for every user-supplied field.
Reproduction
await provider.createSandbox('func-123', 60, {
cpuMilli: 1000,
memoryMB: 512,
metadata: { key: 'val' },
});
Expected body keys: FunctionId, CpuMilli, MemoryMB, Metadata (PascalCase)
Actual body keys: FunctionId, CpuMilli, cpuMilli, MemoryMB, memoryMB, Metadata, metadata (both)
Same issue in listSandboxes for sandboxId, pageNumber, pageSize, status.
Root cause
Lines 72 and 265 in volcengine.ts:
PageSize: params.pageSize || 10,
Status: params.status,
...kwargs[0] // <-- re-introduces raw camelCase keys
Fix
Remove the redundant spread. The explicit mapping already covers all supported parameters. If the Volcengine API rejects unknown keys (or applies stricter param validation), duplicate camelCase keys may cause silent request failures that are hard to diagnose.
PR forthcoming.
Description
In
sdk/js/src/providers/volcengine.ts, bothcreateSandboxandlistSandboxesexplicitly map user-supplied camelCase fields to PascalCase body keys (following Volcengine API conventions), then spread...kwargs[0]on top of the mapping. The spread re-adds the original camelCase keys, producing a JSON body that contains both PascalCase and camelCase duplicates for every user-supplied field.Reproduction
Expected body keys:
FunctionId,CpuMilli,MemoryMB,Metadata(PascalCase)Actual body keys:
FunctionId,CpuMilli,cpuMilli,MemoryMB,memoryMB,Metadata,metadata(both)Same issue in
listSandboxesforsandboxId,pageNumber,pageSize,status.Root cause
Lines 72 and 265 in
volcengine.ts:Fix
Remove the redundant spread. The explicit mapping already covers all supported parameters. If the Volcengine API rejects unknown keys (or applies stricter param validation), duplicate camelCase keys may cause silent request failures that are hard to diagnose.
PR forthcoming.