The /inbox page emits console errors during normal use because Supabase Realtime attempts to open a WebSocket connection that is blocked by the current Content Security Policy. The visible impact is that live message updates can fail or degrade, leaving users dependent on manual refreshes or follow-up fetches after sending messages.
Most of the pasted contentscript.js, moz-extension://, and inpage.js warnings appear to come from browser extensions, not from SMSHub application code. They should be tracked as environmental noise unless they reproduce with extensions disabled.
/inbox subscribes to Supabase Realtime through the browser client in src/components/inbox-client.tsx. The site-wide CSP in next.config.ts currently sets:
connect-src 'self' https:Supabase Realtime uses a secure WebSocket URL:
wss://<project-ref>.supabase.co/realtime/v1/websocketBecause wss: is not allowed by connect-src, the browser blocks the connection and reports:
Content-Security-Policy: The page's settings blocked the loading of a resource (connect-src) at wss://...supabase.co/realtime/v1/websocket
Uncaught Error: WebSocket not available- Restore Supabase Realtime connectivity on
/inbox. - Keep the CSP restrictive while allowing the required Supabase WebSocket endpoint.
- Remove app-owned console errors from
/inboxin a clean browser profile. - Preserve existing inbox behavior for message loading, sending, read-state updates, and delivery-status updates.
- Do not attempt to fix warnings emitted by browser extensions such as MetaMask or other injected content scripts.
- Do not loosen CSP with broad origins unless an environment-specific origin cannot be derived.
- Do not redesign the inbox UI as part of this bug fix.
- The
/inboxpage must successfully subscribe to Supabase Realtime formessagesinserts and updates. - The CSP
connect-srcdirective must allow the configured Supabase Realtime WebSocket endpoint. - The allowed WebSocket source should be derived from
NEXT_PUBLIC_SUPABASE_URLwhen available, convertinghttps://towss://. - If the Supabase URL is unavailable at build/config time, the fallback must be documented and intentionally scoped.
- Browser-extension console warnings must be documented as excluded from app acceptance criteria unless reproducible with extensions disabled.
- Continue to deny framing with
frame-ancestors 'none'andX-Frame-Options: DENY. - Continue to restrict default resources to
'self'. - Avoid adding generic
connect-src *. - Keep
https:for REST/API calls and add only the needed WebSocket allowance for Realtime.
- Add or update a security-header test that asserts
connect-srcincludes the Supabase Realtime WebSocket origin or an intentionally scopedwss:allowance. - Add a regression note or test coverage for
/inboxRealtime subscription setup where practical. - Manually verify
/inboxin a clean browser profile with extensions disabled.
- Visiting
/inboxno longer logs a CSP violation forwss://*.supabase.co/realtime/v1/websocketin a clean browser profile. - New inbound messages appear in the active inbox without a full-page refresh.
- Delivery-status updates continue to update existing messages in place.
- The CSP header still blocks unapproved script, frame, and connection targets.
- Any remaining
contentscript.js,moz-extension://,InstallTrigger,onmozfullscreen*,ObjectMultiplex, or MetaMask-related warnings are documented as browser-extension noise if they do not reproduce with extensions disabled.
- Primary code path:
next.config.ts. - Runtime path using Realtime:
src/components/inbox-client.tsx. - Relevant current failure:
Content-Security-Policy: The page's settings blocked the loading of a resource (connect-src) at wss://sytajbytcdlsbnbkqpyo.supabase.co/realtime/v1/websocket- Recommended approach:
NEXT_PUBLIC_SUPABASE_URL=https://<project-ref>.supabase.co
connect-src 'self' https: wss://<project-ref>.supabase.co- Should local development also allow
ws://localhost:*for any local Realtime or test harness usage? - Should Sentry tunneling or other observability endpoints be explicitly included in
connect-srcif enabled?