Skip to content

Commit

Permalink
Prevent v8 database trying to register with v9 app. (#4801)
Browse files Browse the repository at this point in the history
* Prevent v8 database trying to register with v9 app.

* Create tall-bikes-own.md
  • Loading branch information
yuchenshi authored Apr 21, 2021
1 parent c658836 commit 191184e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tall-bikes-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/database": patch
---

Fixes an internal conflict when using v8 and v9 SDKs in the same package.
6 changes: 4 additions & 2 deletions packages/database/index.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ try {
// @firebase/app when used together with the js sdk. More detail:
// https://github.com/firebase/firebase-js-sdk/issues/1696#issuecomment-501546596
// eslint-disable-next-line import/no-extraneous-dependencies, @typescript-eslint/no-require-imports
const firebase = require('@firebase/app').default;
registerDatabase(firebase);
const firebase = require('@firebase/app').default; // Only present for v8, undefined for v9 (should skip).
if (firebase) {
registerDatabase(firebase);
}
} catch (err) {
// catch and ignore 'MODULE_NOT_FOUND' error in firebase-admin context
// we can safely ignore this error because RTDB in firebase-admin works without @firebase/app
Expand Down

0 comments on commit 191184e

Please sign in to comment.