fix(runner): drop JSON content-type on bodyless light-run requests#20
Merged
Conversation
Service and network teardown silently failed end-to-end. stopRun, the run cancel, and deleteNetwork sent `content-type: application/json` with no body, and Fastify rejects an empty body under that content-type with 400 (FST_ERR_CTP_EMPTY_JSON_BODY). stopServices and the teardown swallowed the error, so the sidecar service container kept running and its run-scoped network leaked (deletion then 409'd on the still-attached container). - add authHeaders() (bearer only, no content-type) for bodyless requests - POST /runs/:id/stop, POST /runs/:id/cancel and DELETE /networks/:name use it build with cc
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 (found in manual e2e of networks + services)
Service and network teardown silently failed. After a workflow with
services+networkDefsfinished, the sidecar service container kept running and its run-scoped network leaked.Root cause
stopRun(POST /runs/:id/stop), the run cancel (POST /runs/:id/cancel), anddeleteNetwork(DELETE /networks/:name) all sentcontent-type: application/jsonwith no body. Fastify rejects an empty body under that content-type with400 FST_ERR_CTP_EMPTY_JSON_BODY, before the route handler runs.stopServicesand the executor teardown swallow per-item errors (best-effort), so:stopRun-> 400 -> swallowed -> service container never stoppeddeleteNetwork-> 400 (and would 409 anyway, network still attached) -> network leakedA
curl -X POST .../stopwith nocontent-typeheader returns 204 and works, which is why the endpoint looked fine in isolation.Fix
authHeaders()(bearer token only, nocontent-type) for bodyless requestsPOST /runs/:id/stop,POST /runs/:id/cancel,DELETE /networks/:nameuse itVerified end-to-end
light run net(networkDef + echo service + probe node): before, the echo container stayedUpandlp-<run>-svc-netleaked after[ok]. After: probe still gets 200, then the service is stopped (run -> cancelled) and the network deleted, no leaks, no stuckrunningruns.build with cc