Skip to content

Volcengine provider: createSandbox/listSandboxes produce duplicate PascalCase+camelCase keys in JSON body #174

@Ricardo-M-L

Description

@Ricardo-M-L

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions