Files
conversation-history/SquareMCP/deployments/2026-06-17-cors-put-fix-deploy.md
T

95 lines
2.5 KiB
Markdown

# Deploy Result — CORS PUT Fix for Communications Profile
**Date:** 2026-06-17
**Commit deployed:** `e6d7f11` (`fix(cors): allow PUT requests; update DCR wildcard redirect_uri test`)
**Service:** hermes-mcp
**Status:** ✅ Committed, pushed, and deployed
----
## Problem
Clicking **Save profile** in the Communications section of `https://app.squaremcp.com` showed "Network error. Please try again."
The frontend (`product/app/communications.js`) calls:
```js
fetch(`${API_BASE}/api/communications/profile`, {
method: 'PUT',
...
})
```
But the Express CORS middleware only allowed `GET, POST, DELETE, OPTIONS`:
```ts
methods: ['GET', 'POST', 'DELETE', 'OPTIONS'],
```
Browsers block the PUT request at the CORS preflight stage, causing the network error.
## Fix
Added `'PUT'` to the allowed CORS methods in `src/index.ts`:
```ts
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
```
Also updated `src/oauth-dcr.test.ts` to match the new wildcard `redirect_uri` behavior from the previous commit.
## Commit & push
```bash
git add src/index.ts src/oauth-dcr.test.ts
git commit -m "fix(cors): allow PUT requests; update DCR wildcard redirect_uri test"
git push origin main
```
Pushed `85cb2db..e6d7f11`.
## Deploy
```bash
cd ~/hermes-mcp
docker build -t localhost:32000/hermes-mcp:e6d7f11 .
docker push localhost:32000/hermes-mcp:e6d7f11
# updated hermes-k8s.yaml image → localhost:32000/hermes-mcp:e6d7f11 (not committed)
microk8s kubectl apply -f hermes-k8s.yaml
microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
## Pod status
```
NAME READY STATUS RESTARTS AGE IP
hermes-mcp-578fbbdf45-jx66j 1/1 Running 0 ... 104.190.60.129
```
## Verification
Preflight response now includes PUT:
```http
HTTP/2 204
access-control-allow-origin: https://app.squaremcp.com
access-control-allow-methods: GET,POST,PUT,DELETE,OPTIONS
access-control-allow-credentials: true
```
Actual PUT request with test user session succeeded:
```bash
curl -b session.txt -X PUT https://hermes.squaremcp.com/api/communications/profile \
-H 'Content-Type: application/json' \
-H 'Origin: https://app.squaremcp.com' \
-d '{"business_type":"mortgage_broker",...}'
```
Returned the saved profile JSON ✅
## Notes
- `hermes-k8s.yaml` image tag updated locally but **not committed**.
- Full `npx vitest run` suite has a pre-existing test-isolation issue in `src/capability-routes.test.ts` (passes in isolation, fails when run with full suite due to mock state pollution). This is unrelated to the CORS fix.