firebase / firebase/firebase-tools

Unexpected key 'endpoints[].taskQueueTrigger.retry'

Open
#8,529 2 comments 1 reaction 1 assignee Claimed by @taeold View on GitHub
api: functions reproducible triaged 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:** 14.3.0

**Platform:** macOS

### [REQUIRED] Test case

Create a new task with TaskQueueOptions and set `retry: false`. This is a valid key according to the Firebase Functions documentation: https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.taskqueueoptions.md#taskstaskqueueoptionsretry

```
export const ExampleTask = onTaskDispatched({
retry: false,
}, () => {
console.log('hello')
});
```

However, when you try to start this task, you will get the following non-descriptive error:
```
Failed to load function definition from source: FirebaseError: Failed to parse build specification
```

### [REQUIRED] Steps to reproduce

To get more information, you will need to run firebase with `--debug` and add the following line to `./node_modules/firebase-tools/lib/deploy/functions/runtimes/discovery/index.js` line 30:

```
logger_1.logger.debug('yamlToBuild', err);
```

This will output

```
yamlToBuild Unexpected key 'endpoints[ExampleTask].taskQueueTrigger.retry'. You may need to install a newer version of the Firebase CLI. {"name":"FirebaseError","children":[],"exit":1,"message":"Unexpected key 'endpoints[ExampleTask].taskQueueTrigger.retry'. You may need to install a newer version of the Firebase CLI.","status":500}
```

The reason this fails is because the YAML parser key assertion logic is not up-to-date with regard to the TaskQueueOptions:

```
assertKeyTypes(prefix + ".taskQueueTrigger", ep.taskQueueTrigger, {
rateLimits: "object?",
retryConfig: "object?",
invoker: "array?",
});
```
https://github.com/firebase/firebase-tools/blob/78f5e2e829934e463a30bdc6bc38eae4af0555a7/src/deploy/functions/runtimes/discovery/v1alpha1.ts#L241

### [REQUIRED] Expected behavior

When starting firebase-tools locally, it should respect the TaskQueueOptions as documented

### [REQUIRED] Actual behavior

It fails with a non-descriptive error:

```
[2025-05-09T09:08:04.237Z] Got response from /__/functions.yaml {"endpoints":{"ExampleTask":{"platform":"gcfv2","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"labels":{},"taskQueueTrigger":{"retryConfig":{"maxAttempts":null,"maxDoublings":null,"maxBackoffSeconds":null,"maxRetrySeconds":null,"minBackoffSeconds":null},"rateLimits":{"maxConcurrentDispatches":null,"maxDispatchesPerSecond":null},"retry":false},"entryPoint":"ExampleTask"}},"specVersion":"v1alpha1","requiredAPIs":[{"api":"cloudtasks.googleapis.com","reason":"Needed for task queue functions"}],"extensions":{}}
⬢ functions: Failed to load function definition from source: FirebaseError: Failed to parse build specification {"metadata":{"emulator":{"name":"functions"},"message":"Failed to load function definition from source: FirebaseError: Failed to parse build specification"}}
```

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.