fix(api): route requests to the correct regional Plaud host - #14
Open
fcroiseaux wants to merge 1 commit into
Open
fix(api): route requests to the correct regional Plaud host#14fcroiseaux wants to merge 1 commit into
fcroiseaux wants to merge 1 commit into
Conversation
Plaud retired the global `api.plaud.ai` host in favor of region-specific hosts (`api-euc1`/`api-use1`/`api-apse1`), with each account's region baked into its JWT. Calling the wrong host now returns an envelope with `msg: "user region mismatch"`, which the client surfaced as a fatal `invalid_response` and broke every sync. The API client now probes the known regional hosts, sticks to the one that accepts the token, and persists it via `onHostResolved` so later sessions skip re-probing. The default domain moves to the EU host, and the settings copy documents that the region is auto-detected. Also send the listing query parameters (`skip`/`limit`/`is_trash`/`sort_by`/`is_desc`) that the current `/file/simple/web` contract expects. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Syncs stopped working with a
Plaud sync failed: unexpected API response formatnotice. Plaud retired the globalapi.plaud.aihost in favor of region-specific hosts (api-euc1,api-use1,api-apse1), and each account's region is baked into its JWT. Calling the wrong host now returns an envelope withmsg: "user region mismatch", which the client mapped to a fatalinvalid_response— breaking every sync for anyone whose account is not on the (now dead) global host.Root cause was confirmed from the live API response, not just docs: the failing call is
listFiles()→GET /file/simple/web(the only unguarded call inrunPlaudSync; per-filegetFileDetailfailures are caught and counted, so they can't produce the top-level "sync failed" notice). The captured envelope was{ status: <non-zero>, msg: "user region mismatch" }.Fix
onHostResolvedcallback lets the plugin persist the resolved host so subsequent sessions skip re-probing (self-healing, and no manual region configuration required).api.plaud.aitoapi-euc1.plaud.ai; the settings copy documents that the region is auto-detected (euc1EU /use1US /apse1APAC).skip/limit/is_trash/sort_by/is_desc) are now sent to match the current/file/simple/webcontract used by other Plaud clients.Tests
onHostResolvedsemantics, and the all-hosts-rejected error path.npm run buildtypecheck is green.🤖 Generated with Claude Code