Skip to content

Cloud tasks headers are not exposed #1340

Open
@AmichayMiara

Description

@AmichayMiara

[REQUIRED] Version info

node: v18.13.0

firebase-functions: 4.1.1

firebase-tools: 11.20.0

firebase-admin: 11.4.1

[REQUIRED] Test case

https://firebase.google.com/docs/functions/task-functions#task_queue_configuration

onDispatch function is getting the task data but not the task headers.

export function onDispatchHandler<Req = any>(
handler: v1TaskHandler | v2TaskHandler<Req>
): (req: https.Request, res: express.Response) => Promise<void> {

We noticed that the headers are exposed when triggered by HTTP target task handler (https://cloud.google.com/tasks/docs/creating-http-target-tasks#handler), and we expect to also get them via onDispatch handler context object.

It seems that the headers can be useful for various purposes.
As an example, We particularly interested in the X-CloudTasks-TaskExecutionCount header, as it would allow us to better understand how tasks are being executed.

image

[REQUIRED] Steps to reproduce

No steps to reproduce. Right now task headers are not accessible using onDispatch.

[REQUIRED] Expected behavior

Task headers to be exposed.

[REQUIRED] Actual behavior

Task headers are not exposed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions