Skip to content

Commit

Permalink
Prevent v8 database trying to register with v9 app.
Browse files Browse the repository at this point in the history
  • Loading branch information
yuchenshi committed Apr 20, 2021
1 parent 364e336 commit a553b4c
Showing 1 changed file with 4 additions and 2 deletions.
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 a553b4c

Please sign in to comment.