Skip to content

PowerShell strips JSON quotes in functions invoke --data #272

Description

@agent-zhang-beihai

What happens

On Windows PowerShell, passing a ConvertTo-Json result as the --data argument through npx.cmd reached the CLI as an object without quoted property names and failed JSON parsing at position 1.

Command

npx @insforge/cli functions invoke ingest --data

Error

Expected property name or '}' in JSON at position 1

Workaround

Invoked the deployed /functions/ingest endpoint with Invoke-RestMethod and the same JSON body.

Triage finding

Triage judged this fixable.

Add client-side JSON.parse validation for --data in CLI/src/commands/functions/invoke.ts:30 (mirroring the existing records/schedules pattern) throwing a CLIError such as "Invalid JSON in --data" plus a shell-quoting hint, optionally add --data-file <path> modeled on the existing compute deploy --env-file, and document Windows/PowerShell JSON quoting in insforge-skills/skills/insforge-cli/SKILL.md:221; verify with a new src/commands/functions/invoke.test.ts asserting --data '{a:1}' fails locally with the clear error and that fetch is never called.

Suggested fix

From automated triage — a starting point, not a verified plan.

Add client-side JSON.parse validation for --data in CLI/src/commands/functions/invoke.ts:30 (mirroring the existing records/schedules pattern) throwing a CLIError such as "Invalid JSON in --data" plus a shell-quoting hint, optionally add --data-file <path> modeled on the existing compute deploy --env-file, and document Windows/PowerShell JSON quoting in insforge-skills/skills/insforge-cli/SKILL.md:221; verify with a new src/commands/functions/invoke.test.ts asserting --data '{a:1}' fails locally with the clear error and that fetch is never called.


Component cli · severity minor · CLI 0.2.1 · win32 10.0.26100

Filed automatically from user feedback.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions