Skip to content

fix(cm-cors): apply cmCors to teams and project-meta routes#382

Merged
field123 merged 1 commit into
masterfrom
fix/cm-cors-teams-project-meta
Jul 14, 2026
Merged

fix(cm-cors): apply cmCors to teams and project-meta routes#382
field123 merged 1 commit into
masterfrom
fix/cm-cors-teams-project-meta

Conversation

@field123

@field123 field123 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Problem

Commerce Manager reads/writes the visual builder uiConfig via GET/PUT /api/v1/teams/:teamId (org scope) and GET /api/v1/projects/:projectId/meta (project scope). These routes were registered without the cmCors middleware, so they fell back to wildcard CORS (Access-Control-Allow-Origin: *), which the browser rejects for credentialed requests. Result in-region (e.g. euwest): "CORS request did not succeed" and the CM Visual Builder config page can't load or save.

Other CM→Plasmic calls (projects, workspaces, hosts, auth, …) work because they already carry cmCors; teams was simply never wired up — CM's config surface is its first-ever caller.

Fix

  • Add cmCors to GET/PUT /api/v1/teams/:teamId and to GET /api/v1/projects/:projectId/meta, plus /api/v1/teams and /api/v1/teams/* preflights — mirroring the existing projects/workspaces registrations (cmCors first, before teamApiUserAuth).
  • The project-meta PUT and all workspaces routes already had cmCors (no change).
  • Extend ep-fork-integrity.spec.ts to assert teams + project-meta carry cmCors so this can't regress.

Test

ep-fork-integrity.spec.ts + cm-cors.spec.ts pass (35 tests).

Commerce Manager reads/writes the visual builder uiConfig via GET/PUT
/api/v1/teams/:teamId (org scope) and GET /api/v1/projects/:projectId/meta
(project scope). These routes were registered without the cmCors middleware,
so they fell back to wildcard CORS (Access-Control-Allow-Origin: *), which the
browser rejects for credentialed requests — CM saw "CORS request did not
succeed" and could not load/save the config.

Add cmCors to those handlers (+ the /api/v1/teams and /api/v1/teams/*
preflights), mirroring the existing projects/workspaces registrations. The
project-meta PUT and the workspaces routes already had cmCors. Extend the
ep-fork-integrity spec to assert teams + project-meta carry cmCors so this
can't regress.
@field123
field123 merged commit 59dd22d into master Jul 14, 2026
9 checks passed
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