firebase / firebase/firebase-tools

Emulator 60s function timeout

Open
#9,754 3 comments 0 reactions 0 assignees View on GitHub
emulators: functions 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:** 15.1.0

**Platform:** macOS 15.7 (Sequoia), arm64 (Apple Silicon M1 Pro)

### [REQUIRED] Test case

Cloud Functions configured with `timeoutSeconds: 540` (9 minutes) are being killed by the Firebase Emulator at exactly 60 seconds, ignoring the configured timeout.

```typescript
// Example function configuration
export const renderClipPreviewVideo = onCall(
{
timeoutSeconds: 540,
memory: '4GiB',
region: 'us-central1',
},
async (request) => {
// Long-running video rendering operation
},
);
```

**firebase.json emulator configuration:**

```json
{
"emulators": {
"functions": {
"host": "0.0.0.0",
"port": 5001
},
"firestore": {
"host": "0.0.0.0",
"port": 8080
},
"storage": {
"host": "0.0.0.0",
"port": 9199
}
}
}
```

### [REQUIRED] Steps to reproduce

1. Create a Cloud Function with `timeoutSeconds` set to any value > 60 seconds (e.g., 540)
2. Start the Firebase emulators: `firebase emulators:start --only functions,firestore,storage`
3. Call the function and have it perform an operation that takes longer than 60 seconds
4. Observe the function being killed at exactly 60 seconds with "socket hang up" error

Environment variable workaround attempted (did not work):

```bash
export FUNCTIONS_EMULATOR_TIMEOUT_SECONDS=540
```

### [REQUIRED] Expected behavior

The Firebase Functions Emulator should respect the `timeoutSeconds` configuration specified in the function definition (e.g., 540 seconds), allowing long-running operations to complete within the configured timeout.

### [REQUIRED] Actual behavior

The emulator ignores the `timeoutSeconds` configuration and enforces a hard 60-second timeout. Functions that exceed 60 seconds are killed with the following errors:

```
⚠ Your function was killed because it raised an unhandled error.
i Request to function failed: Error: socket hang up
```

The function is terminated abruptly regardless of:

- The `timeoutSeconds` value in the function configuration
- The `FUNCTIONS_EMULATOR_TIMEOUT_SECONDS` environment variable
- Any other configuration attempts

This prevents local development and testing of any function that legitimately needs more than 60 seconds to complete (e.g., video processing, large file operations, AI model inference).

Contributor guide

Open the contributing guide

Research direction

No source file or test is named in the report. Start by reproducing the 60-second failure with firebase emulators:start and trace the Functions Emulator timeout path, then compare it with the function's timeoutSeconds value. Done means a function configured above 60 seconds can run to its configured limit without a socket hang up.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.