Skip to content

feat(web-extension): optional rrweb Cloud mode, connected from the dashboard - #2017

Open
roggernaut wants to merge 27 commits into
rrweb-io:mainfrom
roggernaut:feat/web-extension-cloud
Open

roggernaut wants to merge 27 commits into
rrweb-io:mainfrom
roggernaut:feat/web-extension-cloud

Conversation

@roggernaut

@roggernaut roggernaut commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

The extension records and replays sessions locally, so a recording stays in the browser that made it. This adds an optional rrweb Cloud mode that uploads a recording when you stop it. Offline recording works as before, with no account.

On the earlier question about createTransport in @rrweb/browser-client: that change is gone, and packages/browser-client matches main. The extension now keeps a recording's events in the service worker, as offline mode already did, and uploads the finished recording with a small uploader of its own (background/upload.ts) to the public POST /recordings/{id}/events endpoint. There is no WebSocket and no recording ID in sessionStorage, so browser-client needs nothing new.

Behaviour changes in offline mode

  • A recording covers one tab. The <all_urls> content script is gone; the recorder is injected into the current tab with activeTab and scripting when recording starts. This keeps the Web Store listing free of the "read and change all your data on all websites" warning.
  • In Chrome, a reload or a new page on the same site continues the recording: the recorder is injected into the next page under the same recording, which starts with a new full snapshot. The recording ends when the tab closes, or when the browser no longer grants access to the page: another site in Chrome, any new page in Firefox. Following other sites would need optional host permissions, which could come later.
  • Only the top frame is recorded, so cross-origin iframes are no longer recorded.
  • Removing the extension opens a short optional feedback form, with the extension version filled in.
  • The popup, session pages and options page use rrweb's branding, and the recorded tab shows a REC badge.

Change

  • Connecting (Chrome only). The rrweb dashboard sends { orgId, orgName, publicKey } through externally_connectable. The extension accepts a status and a connect message, and only from the dashboard origin it was built with. It has no sign-in of its own and no host permissions.
  • Uploading. In Cloud mode, Stop stores the recording locally, uploads it as NDJSON in chunks of at most 1 MiB with the public key as bearer, then deletes the local copy and opens the recording in the dashboard. Cloud recordings mask typed form input.
  • Failures. Progress is saved after each accepted chunk. A failed or interrupted upload stays in Offline sessions, and Share sends what did not arrive to the same recording.
  • Sharing. Offline sessions can be shared to Cloud after a confirmation, since offline recordings don't mask form input.
  • Recorder state. background/recorder.ts keeps one phase: idle, finding the tab, starting, recording, pausing, paused, resuming, navigating, reattaching or finishing. A step waiting on the page applies its reply only while its phase is current, so a late reply can't touch a newer recording. A start the page never confirms gives up after 15 seconds.
  • The Firefox build has no Cloud mode.

Reviewing

Most of the logic is in background/: recorder.ts, sinks.ts, upload.ts, shareSession.ts and external.ts. The popup and pages are UI on top of that. theme.ts, PageChrome.tsx, the icons and the options page are branding, about 900 lines. Tests are about half of the added lines.

The commit history includes an earlier design with a Clerk sign-in inside the extension and the browser-client transport, replaced in e4bf0b1. The full diff against main is easier to read than the commits one by one.

Testing

  • packages/web-extension: 179 tests, covering the recorder phases and their races, the uploader and its progress, the dashboard messages, sharing and the popup states.
  • Tried in Chrome against a local backend, before the recorder phase refactor: connecting, switching organization, a Cloud recording that uploads on Stop and plays back, and offline recording. Firefox is built but not yet tried by hand.

- Popup in rrweb branding with a dominant sign-up action, log in, and an
  offline "Record offline" path that keeps working with no account.
- Signing in on the rrweb site signs the extension in (Clerk sync host);
  the popup picks a Clerk organization, fetches its public key from
  /get-public-key and stores it with the user it belongs to. A named
  validating state blocks recording until the cached account matches the
  current user.
- Signed-in recordings upload through @rrweb/browser-client tagged
  jsEntrypoint: 'chrome-extension', with Cloud masking defaults.
- One recording is one tab: the recorder is injected on demand with
  activeTab + scripting (no all-sites content script), and it finishes
  like Stop when the tab navigates or closes. Stop opens the recording in
  the dashboard or the local player.
- Account page (organization, log out) and rebranded session pages.

feat(browser-client): export createTransport for callers that own the
recording ID. stop(true) now delivers buffered events in order before the
close marker, and the socket resumes after a reconnect. See changeset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2ed9d01

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@rrweb/web-extension Minor
@rrweb/all Minor
@rrweb/browser-client Minor
@rrweb/packer Minor
@rrweb/record Minor
@rrweb/replay Minor
rrdom-nodejs Minor
rrdom Minor
rrvideo Minor
rrweb-player Minor
rrweb-snapshot Minor
rrweb Minor
@rrweb/types Minor
@rrweb/utils Minor
@rrweb/rrweb-plugin-canvas-webrtc-record Minor
@rrweb/rrweb-plugin-canvas-webrtc-replay Minor
@rrweb/rrweb-plugin-console-record Minor
@rrweb/rrweb-plugin-console-replay Minor
@rrweb/rrweb-plugin-network-record Minor
@rrweb/rrweb-plugin-network-replay Minor
@rrweb/rrweb-plugin-sequential-id-record Minor
@rrweb/rrweb-plugin-sequential-id-replay Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

roggernaut and others added 3 commits November 11, 2026 20:02
The session list, player and Account pages drop the left sidebar for the
floating glass bar used in the rrweb dashboard, with Sessions and Account
links. The session list shows the stored organization name and no longer
loads Clerk, so opening it offline leaves the saved account alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Cloud start now names the account shown in the popup, and the worker
refuses it when the stored account differs. Recording events are accepted
only from the recorded tab's top frame with the recording's token. When the
final upload fails, the recording is kept in the extension and the popup
offers Retry upload or Discard; logging out removes that user's failed
uploads.

browser-client: stop() resolves to a delivery result instead of always
succeeding, postEvents() is exported for retries, large events whose POST
failed are only ever re-sent over HTTP, and flush() also posts while the
first socket is connecting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
@rrweb/all

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/all@2ed9d01

@rrweb/browser-client

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/browser-client@2ed9d01

@rrweb/packer

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/packer@2ed9d01

@rrweb/record

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/record@2ed9d01

@rrweb/replay

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/replay@2ed9d01

rrdom

npm i https://pkg.pr.new/rrweb-io/rrweb/rrdom@2ed9d01

rrdom-nodejs

npm i https://pkg.pr.new/rrweb-io/rrweb/rrdom-nodejs@2ed9d01

rrvideo

npm i https://pkg.pr.new/rrweb-io/rrweb/rrvideo@2ed9d01

rrweb

npm i https://pkg.pr.new/rrweb-io/rrweb@2ed9d01

rrweb-player

npm i https://pkg.pr.new/rrweb-io/rrweb/rrweb-player@2ed9d01

rrweb-snapshot

npm i https://pkg.pr.new/rrweb-io/rrweb/rrweb-snapshot@2ed9d01

@rrweb/types

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/types@2ed9d01

@rrweb/utils

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/utils@2ed9d01

@rrweb/rrweb-plugin-canvas-webrtc-record

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/rrweb-plugin-canvas-webrtc-record@2ed9d01

@rrweb/rrweb-plugin-canvas-webrtc-replay

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/rrweb-plugin-canvas-webrtc-replay@2ed9d01

@rrweb/rrweb-plugin-console-record

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/rrweb-plugin-console-record@2ed9d01

@rrweb/rrweb-plugin-console-replay

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/rrweb-plugin-console-replay@2ed9d01

@rrweb/rrweb-plugin-network-record

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/rrweb-plugin-network-record@2ed9d01

@rrweb/rrweb-plugin-network-replay

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/rrweb-plugin-network-replay@2ed9d01

@rrweb/rrweb-plugin-sequential-id-record

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/rrweb-plugin-sequential-id-record@2ed9d01

@rrweb/rrweb-plugin-sequential-id-replay

npm i https://pkg.pr.new/rrweb-io/rrweb/@rrweb/rrweb-plugin-sequential-id-replay@2ed9d01

commit: 2ed9d01

roggernaut and others added 10 commits November 12, 2026 09:46
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The player page now imports rrweb-player's stylesheet from the package
instead of loading it from a CDN, so it also works offline. The manifest
gains a description, and the Firefox-only browser_style key is no longer
in the Chrome build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The background sets an uninstall URL pointing at a Google Form. No user
data is added to the URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…form

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chrome refuses to inject a script file containing a noncharacter such as
U+FFFE ("isn't UTF-8 encoded"). The inlined postcss compares against
"￾" and the minifier writes it as the raw character, which broke
injecting content/inject.js when recording starts. A small build plugin
writes noncharacters back as \u escapes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The signed-in popup gains an "Offline sessions" link next to "Open
dashboard", and the signed-out header button is labelled "Offline
sessions".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Offline sessions get a Share action on the session list and the player
page (Chrome only). Sharing asks for confirmation first, because offline
recordings don't mask form fields, and links to the privacy policy. The
upload goes to the signed-in organization under a new recording ID, with
event times shifted to the moment of sharing. An interrupted share resumes
to the same recording and organization; deleting a session also removes
anything kept for its share. Once shared, the action opens the recording.

The background worker now registers its message handlers before any async
start-up, so a message that wakes a suspended worker is no longer lost
("Receiving end does not exist").

Also: the session list is titled "Offline Stored Sessions", the popup shows
a labelled "Offline sessions" button in both views and drops the settings
button, "Cloud dashboard" replaces "Open dashboard" and is linked from the
extension pages, and long recording names are truncated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roggernaut
roggernaut marked this pull request as ready for review November 12, 2026 10:28
roggernaut and others added 6 commits November 12, 2026 13:08
The popup has one record button and a Cloud / Offline switch above it, so
a signed-in person can also record offline. Each side of the switch has
its own link underneath (Cloud dashboard, Offline sessions), replacing the
separate buttons at the bottom. The button label and the line under it
follow the switch, and the choice is remembered. Signed out, Offline is
chosen and Cloud asks you to sign in; while Cloud is setting up, Offline
still works. The switch is locked to the running recording's mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gn-out

The service worker now stays awake until a stopped recording's final
upload is delivered or kept for retry, so a slow final POST can no longer
be cut off. Logging out stops any upload still finishing for that user
from re-saving a failed upload, and signing out on the rrweb website now
removes that user's failed uploads too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picking an organization that has no public recording key now says it
isn't set up for recording yet and links to the Cloud dashboard, instead
of a retry that can never work. A failed switch moves the session back to
the previous organization, so the extension and the dashboard stay on the
same one. During setup, an organization without a key is skipped in
favour of one that has a key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While a tab is being recorded, the toolbar icon shows a red badge on that
tab only (a muted red while paused). It is cleared when the recording ends
or the tab goes away. Badge errors are logged and never affect recording.

Also reword the Cloud note to "Form fields are masked."

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cks it

Signed out, the Cloud side of the switch is selectable and shows a short
Cloud screen (sharing by link, AI narration) with Sign up free and Log in
in place of the record button. Offline stays the default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
roggernaut and others added 4 commits November 12, 2026 14:56
Firefox warns about version_name as an unknown manifest key, so only the
Chrome build sets it. Recordings fall back to the manifest version when
there is no version_name, so Firefox recordings no longer say "unknown".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The icons are now the rounded dark rrweb square with the mark drawn 25%
larger and centred. The 16 and 48 px sizes use slightly heavier lines so
the R stays legible in the toolbar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The extension no longer signs in with Clerk or streams through
@rrweb/browser-client. The rrweb dashboard hands it the organization's
public key through externally_connectable, and every recording is kept
in the background like an offline one. In Cloud mode it is stored, then
uploaded through the public ingest API when the person presses Stop,
on the same path Share uses. A failed upload stays in Offline sessions,
where Share finishes it.

This reverts the browser-client transport changes, drops the Clerk SDK,
the cookies permission, the Clerk host permissions and the separate
failed-upload store. A start the page never confirms now gives up after
15 seconds, and the popup names the organization a running recording
started with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roggernaut roggernaut changed the title feat(web-extension): onboard to rrweb Cloud from the extension popup feat(web-extension): optional rrweb Cloud mode, connected from the dashboard Nov 14, 2026
The recorder keeps one phase (idle, finding the tab, starting,
recording, pausing, paused or resuming), and each step waiting on the
page applies its reply only while that phase is still current. The
stored status is a union with one Destination type, so no -1, null or
placeholder token stands in for a state. A second pause or resume
click while one is in flight does nothing, a stale resume never
restarts the page with an earlier recording's token, and stopping
during a resume also stops the page.

Uploads save what is still unsent after each accepted chunk, so a
worker that stops part way resumes there. A pending share no longer
keeps its own copy of the public key and retries with the connected
one. Share uploads keep the worker alive, and open session lists drop
a recording once its upload succeeds.

The external disconnect message is removed (disconnect is a popup
action), the listener derives the dashboard origin from the build
config, and leftover compatibility code for never-released builds is
gone. Masking copy now says typed form input is masked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eoghanmurray

Copy link
Copy Markdown
Collaborator

Ok this is a real improvement especially as we don't need those blanket scary permissions to 'access all websites'...

However it does mean we drop all multi-page navigation.

There is another way wondering if you considered it; basically when user hits 'record' they could be prompted for permissions to all origins/domains associated with the active tab, that way it would follow normal navigation on a website as well as real multi-page flows hop subdomains — www.example.com → app.example.com → checkout.example.com


  1. Manifest adds "optional_host_permissions": ["https:///", "http:///"]. Nothing changes at install, and effect on Chrome 'scariness' i.e. requirement to get it reviewed minimal

  2. When the user hits record, they get an 'Allow' prompt: you look at the tab's URL — which activeTab already lets you read — and widen it into a pattern:

const url = new URL(tab.url);
await chrome.permissions.request({
origins: [*://*.example.com/*]
});

Getting eTLD+1 right technically needs the Public Suffix List (so you don't compute *.co.uk), but a pragmatic heuristic (last two labels, with a small PSL exception list) covers most of it. Navigation within app.example.com is followed; navigation to stripe.com or anywhere else ends the recording.

  1. On grant, the background registers a dynamic content script for that pattern. The existing pageWatch port-disconnect stops meaning "finish the recording" for granted origins and starts meaning "document gone — wait briefly for a successor document on the same tab"; the re-loaded content script reconnects, the recorder re-injects with the same token, a fresh FullSnapshot lands in the same sink. That's main's behavior, rebuilt on the PR's phase machine (it would be a new phase, e.g. navigating, with a timeout falling back to finish).

  2. Navigation to an un-granted origin still ends the recording, exactly as per current version

A recording used to finish when the recorded tab's page went away. It
now follows the tab: when the page goes away the recorder waits up to
30 seconds for the next one to load, injects into it and records it
under the same token, starting with its own FullSnapshot. Whether a page
may be followed is the browser's call: Chrome keeps activeTab access
within the origin of the record click, Firefox drops it on any
navigation, and a refused injection finishes the recording as Stop
does. No permission is added.

A paused recording stays paused across a navigation, and Pause while
the next page loads pauses at once. Stop claims the recording before it
waits, so nothing can follow or finish it meanwhile, and a page still
starting stops itself when it finds the recording gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roggernaut

Copy link
Copy Markdown
Collaborator Author

Thanks, same-site navigation and reloads are followed now (2ed9d01), with the navigating phase you describe and no new permission. Following subdomains through optional_host_permissions makes sense to me as a follow-up PR, so this one stays reviewable. Does that work for you?

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.

2 participants