bitwarden / bitwarden/clients

Uncaught (in promise) Error: Extension context invalidated.

Open
#12,980 11 comments 7 reactions 0 assignees View on GitHub
browser bug
Dominant language
TypeScript
Stars
13.8k
Forks
2k
Avg merge
3d 9h
Merged PRs (30d)
397

Description

### Steps To Reproduce

The issue happens mostly in Angular developed apps, I didn't notice it elsewhere. The Angular I'm using is at version 14.0.0 and this is becoming a problem if I leave the app running overnight. In the morning, the Console is full of these errors:
```
VM7717 bootstrap-autofill-overlay.js:963 Uncaught (in promise) Error: Extension context invalidated.
at VM7717 bootstrap-aut…l-overlay.js:963:56
at new Promise ()
at AutofillOverlayContentService. (VM7717 bootstrap-aut…l-overlay.js:963:16)
at Generator.next ()
at VM7717 bootstrap-aut…l-overlay.js:870:71
at new Promise ()
at __awaiter (VM7717 bootstrap-aut…l-overlay.js:866:12)
at AutofillOverlayContentService.sendExtensionMessage (VM7717 bootstrap-aut…l-overlay.js:957:12)
at AutofillOverlayContentService.handleWindowFocusOutEvent (VM7717 bootstrap-aut…-overlay.js:4692:23)
```

If I disable the extension, there's no issues logged.

### Expected Result

No errors or gracefully handled!

### Actual Result

A Chrome's Developers Console is filled with these errors.

### Screenshots or Videos

![Image](https://github.com/user-attachments/assets/ee4da250-e62f-4638-8ba6-7367c6b89e24)

### Additional Context

_No response_

### Operating System

Windows

### Operating System Version

10 Pro

### Web Browser

Chrome

### Browser Version

132.0.6834.83 (Official Build) (64-bit)

### Build Version

132.0.6834.83 (Official Build) (64-bit)

### Issue Tracking Info

- [x] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with an Angular app in Chrome after leaving it running, then inspect bootstrap-autofill-overlay.js around AutofillOverlayContentService.sendExtensionMessage and handleWindowFocusOutEvent from the stack trace. Trace the rejected promise after the extension context is invalidated. Done means the context invalidation is handled gracefully and the repeated console errors no longer appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.