fix(list-projects): omit type=all query param — self-hosted Infisical rejects it - #26
Conversation
… rejects it Self-hosted Infisical's GET /v1/workspace endpoint does not accept `type=all` as a valid enum value and returns HTTP 422. `all` is the default for list-projects, so every default call fails against self-hosted instances. Only append `?type=<value>` for the real enum values; omit the query parameter entirely when type is unset or "all". No behavior change for Infisical Cloud. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| src/index.ts | Single-line fix that conditionally omits ?type=all from the GET /v1/workspace request; the redundant data.type && guard is the only minor nit. |
Reviews (1): Last reviewed commit: "fix(list-projects): omit type=all query ..." | Re-trigger Greptile
| }[]; | ||
| }[]; | ||
| }>(`${hostUrl}/v1/workspace?type=${data.type}`, { | ||
| }>(`${hostUrl}/v1/workspace${data.type && data.type !== "all" ? `?type=${data.type}` : ""}`, { |
There was a problem hiding this comment.
The
data.type && truthy check is redundant. Because the Zod schema declares .default("all"), data.type is always a non-empty string after parsing — it can never be undefined, null, or "". The guard adds no protection and slightly obscures the intent of the condition.
| }>(`${hostUrl}/v1/workspace${data.type && data.type !== "all" ? `?type=${data.type}` : ""}`, { | |
| }>(`${hostUrl}/v1/workspace${data.type !== "all" ? `?type=${data.type}` : ""}`, { |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
📝 Contributor License Agreement requiredBefore this PR can merge, every contributor must sign the Infisical CLA. Commits from unrecognized email addresses (not linked to a GitHub account):
Please link this email to your GitHub account and push again, or sign with the account that owns it. Once everyone has signed, the check updates automatically — no need to close and reopen the PR. |
Problem
list-projectsalways sends?type=${data.type}toGET /v1/workspace. Whentypeisall(the schema default), self-hosted Infisical rejectstype=allas an invalid enum value and returns HTTP 422, so the tool fails on every default call against self-hosted instances.Fix
Only append
?type=<value>for the real enum values; omit the query parameter entirely whentypeis unset or"all". No behavior change for Infisical Cloud (which toleratestype=all).One line in
src/index.ts.npm run buildpasses.Context
This supersedes #19 (which inadvertently committed a prebuilt
dist/bundle, +780 lines —dist/is gitignored upstream and built via thebuildscript, so it doesn't belong in the diff). This PR is the same source fix, isolated to the one line. Same root cause as #10 and #15.Verified against a self-hosted Infisical instance:
list-projectsreturns422before, succeeds after.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com