Skip to content

fix(deploy): match MIE Container Manager v1 request/response shapes#56

Merged
Taleef7 merged 1 commit into
mainfrom
fix/mieweb-deploy-v1-payloads
Jun 3, 2026
Merged

fix(deploy): match MIE Container Manager v1 request/response shapes#56
Taleef7 merged 1 commit into
mainfrom
fix/mieweb-deploy-v1-payloads

Conversation

@Taleef7

@Taleef7 Taleef7 commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Problem

After PR #55 fixed the API base (/api/v1), the deploy reached the manager but failed on the redesigned v1 contract:

Confirming site 1 exists...
jq: error (at <stdin>:1): Cannot iterate over null (null)

The v1 API wraps every response in a { "data": ... } envelope and restructured the container payloads, so the old .sites[] / .containers[] / template_name / .jobId paths no longer resolve.

What I verified

Probed the live manager API (/api/openapi.json + real responses) and read the manager's own SPA submit code to get the exact shapes:

Call v1 shape
GET /sites .data[].id
GET /sites/{id}/containers/new .data.externalDomains[] (id,name) — /external-domains is admin-only
GET /sites/{id}/containers .data[].id, .data[].status ("running"), .data[].httpEntries[0].externalUrl
GET /jobs/{id} .data.status (success value = "success")
POST /sites/{id}/containers body template:<image> (not template_name); services is an array of flat objects {type,internalPort,externalHostname,externalDomainId,authRequired}; environmentVars array of {key,value}
create response job id from .data.jobId (tolerant fallbacks)

Verification

Read-only checks against the live manager API all pass:

  • site 1 resolves; os.mieweb.org domain id = 1; existing twh-api container id = 380; status = running; url = https://twh-api.os.mieweb.org.
  • bash -n passes; create payload renders exactly like the manager UI's POST body.

The create POST is the only path that can't be exercised without an actual deploy; it's grounded in the manager's own client code, and on any residual mismatch the manager returns a secret-free validation error that the script logs (no env vars are printed).

Merging this to main re-triggers the deploy. No secret change required.

🤖 Generated with Claude Code

After the /api/v1 base fix, the deploy reached the manager but failed on the
redesigned v1 contract ("jq: Cannot iterate over null" on .sites[]). Verified
the real v1 shapes against the live API and the manager's own web client, and
remapped every call:

- Responses are wrapped in a {"data": ...} envelope:
  - GET /sites              -> .data[].id
  - GET .../containers/new  -> .data.externalDomains[] (id, name)
  - GET .../containers      -> .data[].id / .data[].status / .data[].httpEntries[0].externalUrl
  - GET /jobs/{id}          -> .data.status  (success value is "success")
- Create body: `template` (not `template_name`); `services` is an ARRAY of flat
  objects ({type, internalPort, externalHostname, externalDomainId, authRequired}),
  matching what the manager UI POSTs; environmentVars stays an array of {key,value}.
- Create response job id read tolerantly: .data.jobId // .data.creationJobId // .data.id.

Verified read-only against the live manager API: site 1 resolves, os.mieweb.org
domain id = 1, existing twh-api container id = 380, status = running, url =
https://twh-api.os.mieweb.org. bash -n passes. The create POST is the only
unexercised path; on any shape mismatch the manager returns a secret-free
validation error that the script logs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workwell-measure-studio Ready Ready Preview, Comment Jun 3, 2026 3:18pm

@Taleef7 Taleef7 self-assigned this Jun 3, 2026
@Taleef7 Taleef7 merged commit 0a4f58f into main Jun 3, 2026
9 checks passed
@Taleef7 Taleef7 deleted the fix/mieweb-deploy-v1-payloads branch June 3, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant