alyssaxuu/screenity · error · Error
Not authenticated with Screenity
Error message
Not authenticated with Screenity
What it means
When initialize() cannot resolve videoId/mediaId from `reuse`, the resume journal, or the stored video map, it must create a new Bunny video on the backend. Before that POST it asks the extension background (chrome.runtime.sendMessage({type:'check-auth-status'})) whether the user is signed in to Screenity; if the background reports authenticated === false, initialize() throws because creating the video requires a signed-in session. This gates upload creation behind extension sign-in.
Source
Thrown at src/pages/CloudRecorder/bunnyTusUploader.js:924
if (existingMap?.videoId && existingMap?.mediaId) {
this.videoId = existingMap.videoId;
this.mediaId = existingMap.mediaId;
this.journalKey = this.getJournalKey(this.mediaId);
this.debugLog("Reusing Bunny video from map", {
projectId,
sceneId,
type,
mediaId: this.mediaId,
});
}
}
if (!this.videoId || !this.mediaId) {
const { authenticated, user } = await new Promise((resolve) => {
chrome.runtime.sendMessage({ type: "check-auth-status" }, resolve);
});
if (!authenticated) throw new Error("Not authenticated with Screenity");
const { screenityToken } = await chrome.storage.local.get([
"screenityToken",
]);
this.userToken = screenityToken;
if (!this.userToken) {
throw new Error("Missing user token for saving upload metadata");
}
// Retry transient failures so a backend blip doesn't abort the
// recording. A 4xx is a real rejection, so don't retry it.
let res = null;
// This POST gates capture start (canBeginRecording waits on uploader
// init), so its server time is start latency.
const endCreatePost = perfSpan("Uploader POST /bunny/videos", { type });
// Also kept on the instance: the perf timeline is capped and evictsView on GitHub (pinned to 512606387b)
Solutions
- Have the user sign in to Screenity (complete the extension auth flow) before starting a recording, then retry initialize().
- Verify the background service worker handles 'check-auth-status' and reports the correct authenticated value; if it responds undefined, check for a missing/throwing handler.
- If the user appears signed in, clear extension auth state and re-run the sign-in flow to refresh an expired session/cookie.
- Retry after refreshing the token in chrome.storage.local (screenityToken) in case the background state was stale.
Example fix
// before
await uploader.initialize({ projectId, sceneId, type });
// after
const { authenticated } = await chrome.runtime.sendMessage({ type: "check-auth-status" });
if (!authenticated) {
await promptUserSignIn(); // run the Screenity auth flow first
}
await uploader.initialize({ projectId, sceneId, type }); Defensive patterns
Strategy: try-catch
Validate before calling
const { authenticated } = await chrome.runtime.sendMessage({ type: 'check-auth-status' });
if (!authenticated) {
await launchSignInFlow(); // must complete before initializing the uploader
} Type guard
function isAuthStatus(res) {
return res != null && typeof res.authenticated === 'boolean';
} Try / catch
try {
await uploader.initialize({ projectId, sceneId, type });
} catch (err) {
if (String(err?.message).includes('Not authenticated with Screenity')) {
await promptUserSignIn(); // UI sign-in, then retry once
await uploader.initialize({ projectId, sceneId, type });
} else throw err;
} Prevention
- Gate the record button on a known-good check-auth-status result before starting capture.
- Handle the background responding undefined (missing handler) rather than treating it as authenticated.
- Proactively refresh auth state on extension service-worker startup.
- Surface a sign-in prompt instead of silently starting a recording.
When it happens
Trigger: Uploader initialize() reached the 'no existing video' path (no reuse, no journal, no video map) AND the background's check-auth-status responded authenticated:false — i.e. sendMessage succeeded but the user is logged out or the background auth state was never populated.
Common situations: User signed out of Screenity (or never signed in) and then started a cloud recording; extension background service worker restarted and lost cached auth state; auth cookie/token expired between sign-in and recording start.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
AI-assisted analysis of alyssaxuu/screenity@512606387b (2026-09-02).
Data as JSON: /api/errors/cbaf07ffc7bb98a5.
Report an issue: GitHub.