fix(frontend): silence Unchecked runtime.lastError from extension messaging callbacks - #2139
Conversation
…allbacks The STORE_REFRESH_TOKEN and REMOVE_REFRESH_TOKEN calls to the Postiz browser extension passed a no-op callback. When the extension is not installed, disabled, or the origin is not allowed, Chrome logs "Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist." to the user's console because nothing read lastError. Reading it in the callback, as add.provider.component.tsx already does, marks the error as checked and silences the log. The calls stay fire-and-forget with no behavior change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Strix Security ReviewNo security issues found. Review summaryReviewed the two-file diff to Updated for Reviewed by Strix |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
What kind of change does this PR introduce?
Bug fix (frontend, browser extension messaging). The two
chrome.runtime.sendMessagecalls that talk to the Postiz browser extension,STORE_REFRESH_TOKENinapps/frontend/src/components/launches/continue.integration.tsxandREMOVE_REFRESH_TOKENinapps/frontend/src/components/launches/menu/menu.tsx, passed a no-op callback. The callbacks now readchrome.runtime.lastError, matching the existing PING / GET_COOKIES callbacks inadd.provider.component.tsx. The messages, their payloads, when they are sent, and the surroundingtry/catchguards are unchanged; the calls remain fire-and-forget with no toast or Sentry capture.Why was this change needed?
When the extension is not installed, disabled, or the page origin is not in its
externally_connectablelist, Chrome fails the message and logs this to the user's browser console, once per channel connect and once per channel delete:Chrome only emits that line when the callback does not read
lastError. Since most users do not have the extension, this shows up as a red error in the console of ordinary sessions and muddies debugging. ReadinglastErrorin the callback is the documented way to mark the error as handled.Other information:
The third call site already does this, so this only brings the two remaining callbacks in line. Unrelated to the Sentry "Could not establish connection" issues on
/launchesand/auth, whose frames come from third-party injected scripts, not from these calls.QA
EXTENSION_IDset to an extension id that is not installed in your Chrome profile (or to the real Postiz extension id with the extension disabled underchrome://extensions).Unchecked runtime.lastError: Could not establish connectionline in the console (onmainit appears once here).Unchecked runtime.lastErrorline (onmainit appears once here too).Checklist:
Put a "X" in the boxes below to indicate you have followed the checklist;
🤖 Generated with Claude Code