From f1ad765f9a8de83bfd5266ab5a0695010b9206a2 Mon Sep 17 00:00:00 2001 From: Andrew Hopkins Date: Wed, 22 Dec 2021 22:04:42 +1000 Subject: [PATCH 1/5] Check for missing databaseURL on emulator start --- src/providers/database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/database.ts b/src/providers/database.ts index 76252d515..ff908d34a 100644 --- a/src/providers/database.ts +++ b/src/providers/database.ts @@ -369,7 +369,7 @@ export class DataSnapshot { private app?: firebase.app.App, instance?: string ) { - if (app && app.options.databaseURL.startsWith('http:')) { + if ( app && app.options && app.options.databaseURL && app.options.databaseURL.startsWith('http:') ) { // In this case we're dealing with an emulator this.instance = app.options.databaseURL; } else if (instance) { From 1dd36c99d8ab0691a427df3fd9b67b55f82bf3b8 Mon Sep 17 00:00:00 2001 From: Andrew Hopkins Date: Fri, 14 Jan 2022 22:56:34 +1000 Subject: [PATCH 2/5] Updated commit to use ES6 Optional Chaining --- src/providers/database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/database.ts b/src/providers/database.ts index ff908d34a..b26b5bb77 100644 --- a/src/providers/database.ts +++ b/src/providers/database.ts @@ -369,7 +369,7 @@ export class DataSnapshot { private app?: firebase.app.App, instance?: string ) { - if ( app && app.options && app.options.databaseURL && app.options.databaseURL.startsWith('http:') ) { + if ( app?.options?.databaseURL?.startsWith('http:') ) { // In this case we're dealing with an emulator this.instance = app.options.databaseURL; } else if (instance) { From 60c2e41ef2799bf70328c47584ae54f05526292e Mon Sep 17 00:00:00 2001 From: Andrew Hopkins Date: Fri, 14 Jan 2022 22:59:49 +1000 Subject: [PATCH 3/5] Added bugfix to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d6230214..1165d1976 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,3 @@ - Parallelizes network calls that occur when validating authorization for onCall handlers. - Adds new regions to V2 API +- Bug Fix - Check for missing options / databaseURL on emulator start From b03098c3b63541263cbdde80d45e24b8fc4c11ec Mon Sep 17 00:00:00 2001 From: Andrew Hopkins Date: Sun, 16 Jan 2022 15:54:34 +1000 Subject: [PATCH 4/5] Update CHANGELOG.md to consistent phrasing Co-authored-by: Daniel Lee --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1165d1976..2c8c9b14f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ - Parallelizes network calls that occur when validating authorization for onCall handlers. - Adds new regions to V2 API -- Bug Fix - Check for missing options / databaseURL on emulator start +- Fixes bug where the emulator crashed when given app without an `options` property. From e7480c87cdad411b89e37e020997f3722bacd6dc Mon Sep 17 00:00:00 2001 From: Hoppi164 Date: Wed, 19 Jan 2022 20:41:27 +1000 Subject: [PATCH 5/5] format:fix removed padding spaces --- src/providers/database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/database.ts b/src/providers/database.ts index b26b5bb77..53eb9ba12 100644 --- a/src/providers/database.ts +++ b/src/providers/database.ts @@ -369,7 +369,7 @@ export class DataSnapshot { private app?: firebase.app.App, instance?: string ) { - if ( app?.options?.databaseURL?.startsWith('http:') ) { + if (app?.options?.databaseURL?.startsWith('http:')) { // In this case we're dealing with an emulator this.instance = app.options.databaseURL; } else if (instance) {