diff --git a/.changeset/tough-taxis-travel.md b/.changeset/tough-taxis-travel.md new file mode 100644 index 00000000000..eab1d8dee7f --- /dev/null +++ b/.changeset/tough-taxis-travel.md @@ -0,0 +1,5 @@ +--- +'@firebase/auth': patch +--- + +Modify \_fail to use AuthErrorCode.INTERNAL_ERROR and pass in error message. diff --git a/config/functions/package.json b/config/functions/package.json index 3236a3c6600..73b34bd2f06 100644 --- a/config/functions/package.json +++ b/config/functions/package.json @@ -3,7 +3,7 @@ "description": "Cloud Functions for Firebase", "dependencies": { "cors": "2.8.5", - "firebase-admin": "11.3.0", + "firebase-admin": "11.5.0", "firebase-functions": "3.24.1" }, "private": true, diff --git a/packages/auth-compat/demo/functions/package.json b/packages/auth-compat/demo/functions/package.json index 37bc91236a1..7eaa8323080 100644 --- a/packages/auth-compat/demo/functions/package.json +++ b/packages/auth-compat/demo/functions/package.json @@ -9,7 +9,7 @@ "logs": "firebase functions:log" }, "dependencies": { - "firebase-admin": "11.3.0", + "firebase-admin": "11.5.0", "firebase-functions": "3.24.1" }, "private": true diff --git a/packages/auth-compat/package.json b/packages/auth-compat/package.json index 3eb18cfe4ce..09989017f73 100644 --- a/packages/auth-compat/package.json +++ b/packages/auth-compat/package.json @@ -64,7 +64,7 @@ "rollup": "2.79.1", "rollup-plugin-replace": "2.2.0", "rollup-plugin-typescript2": "0.31.2", - "selenium-webdriver": "4.5.0", + "selenium-webdriver": "4.8.0", "typescript": "4.7.4" }, "repository": { diff --git a/packages/auth/demo/functions/package.json b/packages/auth/demo/functions/package.json index aaef4635a27..07e5b235b5e 100644 --- a/packages/auth/demo/functions/package.json +++ b/packages/auth/demo/functions/package.json @@ -9,7 +9,7 @@ "logs": "firebase functions:log" }, "dependencies": { - "firebase-admin": "11.3.0", + "firebase-admin": "11.5.0", "firebase-functions": "3.24.1" }, "private": true, diff --git a/packages/auth/package.json b/packages/auth/package.json index d41368e41d6..9cc395b9447 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -125,7 +125,7 @@ "rollup": "2.79.1", "rollup-plugin-sourcemaps": "0.6.3", "rollup-plugin-typescript2": "0.31.2", - "selenium-webdriver": "4.5.0", + "selenium-webdriver": "4.8.0", "typescript": "4.7.4", "@types/express": "4.17.14" }, diff --git a/packages/auth/src/api/index.test.ts b/packages/auth/src/api/index.test.ts index 74da561f273..579f6c5e8ad 100644 --- a/packages/auth/src/api/index.test.ts +++ b/packages/auth/src/api/index.test.ts @@ -308,6 +308,26 @@ describe('api/_performApiRequest', () => { }); }); + context('with non-Firebase Errors', () => { + afterEach(mockFetch.tearDown); + + it('should handle non-FirebaseErrors', async () => { + mockFetch.setUpWithOverride(() => { + return new Promise<never>((_, reject) => reject(new Error('error'))); + }); + const promise = _performApiRequest<typeof request, never>( + auth, + HttpMethod.POST, + Endpoint.SIGN_UP, + request + ); + await expect(promise).to.be.rejectedWith( + FirebaseError, + 'auth/internal-error' + ); + }); + }); + context('with network issues', () => { afterEach(mockFetch.tearDown); @@ -345,24 +365,6 @@ describe('api/_performApiRequest', () => { expect(clock.clearTimeout).to.have.been.called; clock.restore(); }); - - it('should handle network failure', async () => { - mockFetch.setUpWithOverride(() => { - return new Promise<never>((_, reject) => - reject(new Error('network error')) - ); - }); - const promise = _performApiRequest<typeof request, never>( - auth, - HttpMethod.POST, - Endpoint.SIGN_UP, - request - ); - await expect(promise).to.be.rejectedWith( - FirebaseError, - 'auth/network-request-failed' - ); - }); }); context('edgcase error mapping', () => { diff --git a/packages/auth/src/api/index.ts b/packages/auth/src/api/index.ts index 47c292868f4..0194c43d9a5 100644 --- a/packages/auth/src/api/index.ts +++ b/packages/auth/src/api/index.ts @@ -181,7 +181,7 @@ export async function _performFetchWithErrorHandling<V>( if (e instanceof FirebaseError) { throw e; } - _fail(auth, AuthErrorCode.NETWORK_REQUEST_FAILED); + _fail(auth, AuthErrorCode.INTERNAL_ERROR, { 'message': String(e) }); } } diff --git a/packages/firebase/tsconfig.json b/packages/firebase/tsconfig.json index a06ed9a374c..741f57b2ae4 100644 --- a/packages/firebase/tsconfig.json +++ b/packages/firebase/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "dist" }, "exclude": [ - "dist/**/*" + "**/dist/**/*" ] } \ No newline at end of file diff --git a/packages/rules-unit-testing/functions/package.json b/packages/rules-unit-testing/functions/package.json index db56e4ea4be..2efffd3b6ae 100644 --- a/packages/rules-unit-testing/functions/package.json +++ b/packages/rules-unit-testing/functions/package.json @@ -8,7 +8,7 @@ }, "private": true, "dependencies": { - "firebase-admin": "11.3.0", + "firebase-admin": "11.5.0", "firebase-functions": "3.24.1" }, "engines": { diff --git a/yarn.lock b/yarn.lock index a11c2143260..bf7b1824e23 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15380,14 +15380,14 @@ selenium-webdriver@3.6.0, selenium-webdriver@^3.0.1: tmp "0.0.30" xml2js "^0.4.17" -selenium-webdriver@4.5.0: - version "4.5.0" - resolved "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.5.0.tgz#7e20d0fc038177970dad81159950c12f7411ac0d" - integrity sha512-9mSFii+lRwcnT2KUAB1kqvx6+mMiiQHH60Y0VUtr3kxxi3oZ3CV3B8e2nuJ7T4SPb+Q6VA0swswe7rYpez07Bg== +selenium-webdriver@4.8.0: + version "4.8.0" + resolved "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.8.0.tgz#386d57f23fe8edf5178f5bd06aae9ffaffbcb692" + integrity sha512-s/HL8WNwy1ggHR244+tAhjhyKMJnZLt1HKJ6Gn7nQgVjB/ybDF+46Uui0qI2J7AjPNJzlUmTncdC/jg/kKkn0A== dependencies: jszip "^3.10.0" tmp "^0.2.1" - ws ">=8.7.0" + ws ">=8.11.0" selenium-webdriver@^4.0.0-alpha.7: version "4.0.0-rc-1" @@ -18108,10 +18108,10 @@ ws@>=7.4.6: resolved "https://registry.npmjs.org/ws/-/ws-8.2.2.tgz#ca684330c6dd6076a737250ed81ac1606cb0a63e" integrity sha512-Q6B6H2oc8QY3llc3cB8kVmQ6pnJWVQbP7Q5algTcIxx7YEpc0oU4NBVHlztA7Ekzfhw2r0rPducMUiCGWKQRzw== -ws@>=8.7.0: - version "8.9.0" - resolved "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz#2a994bb67144be1b53fe2d23c53c028adeb7f45e" - integrity sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg== +ws@>=8.11.0: + version "8.12.0" + resolved "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz#485074cc392689da78e1828a9ff23585e06cddd8" + integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig== ws@^7.2.3: version "7.5.5"