Skip to content

fix: delete requests drop query params passed via {query: ...} - #1668

Merged
gjtorikian merged 1 commit into
mainfrom
fix/delete-query-params
Jul 30, 2026
Merged

fix: delete requests drop query params passed via {query: ...}#1668
gjtorikian merged 1 commit into
mainfrom
fix/delete-query-params

Conversation

@claude

@claude claude Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Requested by Kat Brandt · Slack thread

Description

Before: calling pipes.deleteUserConnectedAccount({ ..., organizationId }) or vault.deleteObject({ id, versionCheck }) sends ?query=%5Bobject+Object%5D on the wire — organization_id and version_check are silently dropped, so the API never sees them.

After: the real params are sent (?organization_id=... / ?version_check=...), and no junk query param appears.

How: WorkOS#delete(path, query?) takes the query object bare, unlike get/post/put which take { query: {...} }. These two callers passed the wrapped shape, so URLSearchParams stringified the nested object. This PR passes the query objects bare, tightens WorkOS#delete's query parameter from any to Record<string, string | number | boolean | undefined> so the wrapped shape no longer typechecks, and adds spec assertions on the actual query string for both methods.

Fixes #1667

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] No

Generated by Claude Code

WorkOS#delete takes the query object bare as its second argument,
unlike get/post/put which take { query: {...} }. Two callers passed
the wrapped shape, so URLSearchParams stringified the nested object
and the request carried ?query=[object Object] instead of the real
params:

- pipes.deleteUserConnectedAccount dropped organization_id
- vault.deleteObject dropped version_check

Pass the query objects bare, tighten WorkOS#delete's query parameter
from any to a flat record type so the wrapped shape no longer
typechecks, and assert the actual query strings in both specs.

Fixes #1667
@gjtorikian
gjtorikian marked this pull request as ready for review July 30, 2026 17:25
@gjtorikian
gjtorikian requested review from a team as code owners July 30, 2026 17:25
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes DELETE query serialization by passing organization and version-check parameters directly to the shared client, narrows the accepted query type, and adds request-level regression assertions.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness, compatibility, or security issues identified.

The corrected callers now match the existing DELETE transport contract, supplied and omitted optional values serialize correctly, and all repository call sites remain compatible with the narrowed query type.

Important Files Changed

Filename Overview
src/pipes/pipes.ts Passes organization_id directly as the DELETE query parameter, matching the transport contract.
src/pipes/pipes.spec.ts Verifies the connected-account deletion request includes organization_id without a spurious query parameter.
src/vault/vault.ts Passes the optional optimistic-concurrency version_check directly in the DELETE query.
src/vault/vault.spec.ts Verifies object deletion serializes version_check correctly and omits the malformed wrapper.
src/workos.ts Narrows DELETE query values to scalar URL-search-parameter-compatible types without breaking repository call sites.

Reviews (1): Last reviewed commit: "fix: pass query params to delete request..." | Re-trigger Greptile

@gjtorikian

Copy link
Copy Markdown
Contributor

This code comes from the autogenerator, but I patched the fix up there too. lgtm

@gjtorikian
gjtorikian merged commit 08a8a73 into main Jul 30, 2026
7 checks passed
@gjtorikian
gjtorikian deleted the fix/delete-query-params branch July 30, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

pipes.deleteUserConnectedAccount never sends organization_id, so org-scoped connected accounts cannot be deleted

2 participants