firebase / firebase/firebase-js-sdk
runTransaction doesn't work in Chrome extension MV3
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
* Operating System version: Ubuntu 20.04.3 LTS
* Browser version: 102.0.5005.61
* Firebase SDK version: 9.6.5
* Firebase Product: firestore
* Chrome extension: VM3
### The problem
I can't use `runTransaction` in Chrome extension MV3 as it [doesn't support](https://developer.chrome.com/docs/extensions/mv3/migrating_to_service_workers/#workers) `XMLHttpRequest`. All other commands work well.
I found that it was [fixed](https://github.com/firebase/firebase-js-sdk/pull/4939) on GH (for some reasons, not for transactions).
#### Steps to reproduce:
```javascript
let userRef = doc(db, 'users', userInfo.id);
runTransaction(db, transaction => {
return transaction.get(userRef).then(userDoc => {
return transaction.update(userRef, { 'eventName': 42 });
});
});
```
I got an error: `Uncaught (in promise) FirebaseError: ReferenceError: XMLHttpRequest is not defined`
My assumption is that V9 still uses `XMLHttpRequest` in `runTransaction`.
Contributor guide
Assessment
This issue has not been assessed yet.