firebase / firebase/firebase-js-sdk

FR: Distinguish between 500 errors from the server and network errors in firebase functions

Open
#7,011 2 comments 1 reaction 0 assignees View on GitHub
api: functions feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

Calling functions when there is no network connection, for example, will return an Internal error.
If functions returns 500, it also returns an Internal error, so we cannot distinguish between the two.

![2023-02-06_114957](https://user-images.githubusercontent.com/7393198/216873270-579cd954-cc37-4202-929f-a9938adc1256.jpg)

In the case of auth, an `auth/network-request-failed` error is returned when there is no network connection.

https://github.com/firebase/firebase-js-sdk/blob/04dcdbb0f5b19e51082a846463d84aadb77e98d4/packages/auth/src/api/index.ts#L184

I would like to be able to distinguish between these for recovery and error investigation.

### edit:

#### workaround

`INTERNAL`: Error on the functions side
`internal`: basically a network problem

Contributor guide

Open the contributing guide

Research direction

Start with the linked reference in packages/auth/src/api/index.ts around line 184 to compare how network failures are classified. Then trace the corresponding Firebase Functions error handling and identify where a server 500 and a network failure become indistinguishable. Done means the two cases expose distinct errors suitable for recovery and investigation, with focused tests added where the existing handling is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.