firebase / firebase/firebase-tools

[emulator] HTTP 408 Response missing data using auth emulator

Open
#5,446 5 comments 0 reactions 1 assignee Claimed by @christhompsongoogle View on GitHub
emulators: auth type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:*10.6.0* (also tried newest version)

**Platform:*Ubuntu*

### [REQUIRED] Test case

I am not able to reproduce it outside of our repository and only happens while in a CI environment. Open to ideas on how to create a repo if anyone has ideas. It is not consistently reproducible even in our CI, only happens every so often and a rerun works every time.

Note: we are also running multiple emulators in parallel (all different ports) not sure if that would have anything to do with it.

### [REQUIRED] Steps to reproduce

Spin up emulator using `node node_modules/.bin/firebase emulators:start` with a firebase.json

```
{
"emulators": {
"auth": {
"port": 9117
},
"ui": {
"enabled": true,
"port": 4117
},
"logging": {
"port": 4517
},
"hub": {
"port": 4417
}
}
}
```

Our E2E tests using Jest and Supertest run by spinning up a Nestjs API in memory and making requests to it. Issue comes up every so often with no detectible patterns.

### [REQUIRED] Expected behavior

Emulator does not return HTTP 408 errors.

### [REQUIRED] Actual behavior

```
Error while parsing response data: "Error: HTTP response missing data.". Raw server response: "". Status code: "408". Outgoing request: "POST http://localhost:9114/identitytoolkit.googleapis.com/v1/projects//accounts:lookup."
```

The only debug logs I see are
```
[2023-01-20T20:14:52.446Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
Failed to authenticate, have you run firebase login?
⚠ emulators: You are not currently authenticated so some features may not work correctly. Please run firebase login to authenticate the CLI.
i emulators: Starting emulators: auth {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth"}}
[2023-01-20T20:14:52.486Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-01-20T20:14:52.486Z] [auth] Authentication Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-01-20T20:14:52.486Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4402},{"address":"::1","family":"IPv6","port":4402}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4102},{"address":"::1","family":"IPv6","port":4102}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4502}],"auth":[{"address":"127.0.0.1","family":"IPv4","port":9102}]},"metadata":{"message":"assigned listening specs for emulators"}}
[2023-01-20T20:14:52.508Z] [hub] writing locator at /tmp/hub-.json
```

There is some failed to authenticate stuff in there but those logs are also outputted for e2e tests that spin up emulators and also pass so I think its a red herring. We aren't using any functionality that would require authentication with the CLI I don't think, just the Auth emulator.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.