firebase / firebase/firebase-tools

Cryptic error "functions: Failed to load function definition from source: FetchError: request to http://127.0.0.1:8142/__/functions.yaml failed, reason: socket hang up"

Open
#8,085 2 comments 0 reactions 0 assignees View on GitHub
api: functions reproducible 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:** 13.29.1

**Platform:** Fedora Linux

### [REQUIRED] Test case

Call `process.exit(1)` from the cloud function. A real-life situation would be to test for the presence of an env var:
```js
if (!SOME_VAR)
process.exit(1);
```

### [REQUIRED] Steps to reproduce

`firebase emulators:start --only functions` or `firebase deploy --only functions`

### [REQUIRED] Expected behavior

A non-cryptic error that could help the developer identify its cause. For example "Your function exited with a non-zero status code".

### [REQUIRED] Actual behavior

```
[2024-12-30T10:25:58.513Z] Failed to find version of module node: reached end of search path ./node_modules
✔ functions: Using node@22 from host.
i functions: Loaded environment variables from .env.
[2024-12-30T10:25:58.516Z] Could not find functions.yaml. Must use http discovery
[2024-12-30T10:25:58.518Z] Found firebase-functions binary at './node_modules/.bin/firebase-functions'
Serving at port 8303

[2024-12-30T10:25:59.022Z] Failed to call quitquitquit. This often means the server failed to start request to http://localhost:8303/__/quitquitquit failed, reason: {"message":"request to http://localhost:8303/__/quitquitquit failed, reason: ","type":"system","errno":"ECONNREFUSED","code":"ECONNREFUSED"}
⬢ functions: Failed to load function definition from source: FetchError: request to http://127.0.0.1:8303/__/functions.yaml failed, reason: socket hang up {"metadata":{"emulator":{"name":"functions"},"message":"Failed to load function definition from source: FetchError: request to http://127.0.0.1:8303/__/functions.yaml failed, reason: socket hang up"}}
[2024-12-30T10:25:59.026Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.

┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://127.0.0.1:4000/ │
└─────────────────────────────────────────────────────────────┘

┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├───────────┼────────────────┼─────────────────────────────────┤
│ Functions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │
└───────────┴────────────────┴─────────────────────────────────┘
Emulator Hub running at 127.0.0.1:4400
Other reserved ports: 4500
```

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.