Skip to content

PostMessageTransport logs noisy console.error for expected unknown sources during development #237

@olaservo

Description

@olaservo

When using AppBridge with Vite dev server (or similar HMR tooling), the console is filled with error logs:

Ignoring message from unknown source MessageEvent {isTrusted: true, data: {…}, origin: 'http://localhost:8081', ...}

This comes from src/message-transport.ts:80:

console.error("Ignoring message from unknown source", event);

Cause

This is a dev-only issue. During development:

  • Vite sends HMR (hot module reload) messages to all windows
  • Browser extensions may also send messages
  • AppBridge's PostMessageTransport receives these and logs errors

In production builds without dev servers, this noise doesn't occur.

Problem

Using console.error for expected/benign dev-time events creates noise that obscures real errors during development - exactly when clear console output matters most.

Suggested Fix

Change to console.debug so it's hidden by default but still available when needed:

console.debug("Ignoring message from unknown source", event);

Alternatively, filter known noise sources (e.g., messages containing vite or hot-update in the data).


🦉 Drafted with Claude Code and reviewed by @olaservo

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions