Skip to content

Fix: add fcm/autopush host_permissions so 'Send test push' isn't CORS-blocked#5

Merged
amiller merged 1 commit into
mainfrom
push-host-perms
May 3, 2026
Merged

Fix: add fcm/autopush host_permissions so 'Send test push' isn't CORS-blocked#5
amiller merged 1 commit into
mainfrom
push-host-perms

Conversation

@amiller

@amiller amiller commented May 3, 2026

Copy link
Copy Markdown
Contributor

The Send test push button was failing because the SW's fetch to `fcm.googleapis.com` was CORS-blocked — manifest granted `.google.com` but not `.googleapis.com`.

Adds the three major web-push service hosts:

Also surfaces real errors from `sendWebPush` (status code + response body) instead of generic "failed", and adds a Playwright regression test that asserts the request reaches FCM (any HTTP status) rather than being CORS-blocked.

7/7 tests pass.

⚠️ Reload via Load unpacked (full remove + re-add) since `host_permissions` changed.

🤖 Generated with Claude Code

…t CORS-blocked

The "Send test push" button failed with a generic "Failed to fetch"
because the SW's fetch to https://fcm.googleapis.com/... was getting
CORS-blocked. The manifest grants *.google.com but NOT *.googleapis.com,
and FCM lives at fcm.googleapis.com.

Adds the three major web-push service hosts to host_permissions:
  - https://fcm.googleapis.com/*       (Chrome / Edge)
  - https://updates.push.services.mozilla.com/*  (Firefox)
  - https://web.push.apple.com/*       (Safari)

Also improves error reporting in sendWebPush:
  - On fetch throw: surfaces the message + a hint about host_permission
  - On non-2xx: includes the status code AND truncated response body so
    the dashboard shows what FCM actually said instead of just "failed"

Adds a Playwright regression test that injects a fake FCM endpoint and
clicks "Send test push", then asserts the dashboard does NOT show
"fetch failed" / "Failed to fetch" — only a real push-service status.

Reload via Load unpacked (full remove + re-add) since host_permissions
changed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@amiller amiller merged commit dd5b1b7 into main May 3, 2026
1 check failed
@amiller amiller deleted the push-host-perms branch May 3, 2026 18: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