Summary
apimatic portal toc new handles a failed TOC extraction badly in two independent
ways. Reproduce with apimatic auth logout then
apimatic portal toc new --input <dir-with-src/spec> --force:
▲ Falling back to the default TOC structure.
● The TOC file successfully created at: …\src\content\toc.yml
└ Succeeded
<hangs — never exits>
1. The 401 is swallowed. actions/portal/toc/new-toc.ts:86-89 treats every
generateTocData error as benign: it overwrites the existing toc.yml with one
containing no endpoint/model/webhook components and returns
ActionResult.success() (exit 0). The user is never told to log in, and CI sees
success. portal-service.ts:333 already produces the right message — the action
discards it.
2. The process then hangs indefinitely. generateTocData is a
stream-response endpoint, so on error the SDK returns ApiError.body as an
undrained IncomingMessage. The TLS socket stays open, and since outro() only
sets process.exitCode (prompts/format.ts:48) with no process.exit anywhere,
Node waits forever. Confirmed by handle probe (TLSSocket … readable=true);
destroying that stream turns a 90s hang into a 3s exit 0. Not specific to this
command or to being logged out — latent in any stream-endpoint error, including
the portal and SDK download calls.
Expected
An actionable auth message, a non-zero exit, the existing toc.yml left
untouched, and the process exiting.
Summary
apimatic portal toc newhandles a failed TOC extraction badly in two independentways. Reproduce with
apimatic auth logoutthenapimatic portal toc new --input <dir-with-src/spec> --force:▲ Falling back to the default TOC structure.
● The TOC file successfully created at: …\src\content\toc.yml
└ Succeeded
<hangs — never exits>
1. The 401 is swallowed.
actions/portal/toc/new-toc.ts:86-89treats everygenerateTocDataerror as benign: it overwrites the existingtoc.ymlwith onecontaining no endpoint/model/webhook components and returns
ActionResult.success()(exit 0). The user is never told to log in, and CI seessuccess.
portal-service.ts:333already produces the right message — the actiondiscards it.
2. The process then hangs indefinitely.
generateTocDatais astream-response endpoint, so on error the SDK returns
ApiError.bodyas anundrained
IncomingMessage. The TLS socket stays open, and sinceoutro()onlysets
process.exitCode(prompts/format.ts:48) with noprocess.exitanywhere,Node waits forever. Confirmed by handle probe (
TLSSocket … readable=true);destroying that stream turns a 90s hang into a 3s exit 0. Not specific to this
command or to being logged out — latent in any stream-endpoint error, including
the portal and SDK download calls.
Expected
An actionable auth message, a non-zero exit, the existing
toc.ymlleftuntouched, and the process exiting.