Skip to content

Cloud tasks headers are not exposed #1340

Closed

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.

Activity

  1. google-oss-bot commented on Jan 19, 2023

    @google-oss-bot
    Collaborator

    I found a few problems with this issue:

    • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
    • This issue does not seem to follow the issue template. Make sure you provide all the required information.
  2. taeold commented on Jan 19, 2023

    @taeold
    Contributor

    Thanks for the feature request @AmichayMiara!

    Internal note: similar to #1178

  3. sdegroot commented on Apr 13, 2023

    @sdegroot

    Hi all, is there any known planning on when this feature will be released?

  4. gustavopch commented on Apr 6, 2024

    @gustavopch

    This was actually released in https://github.com/firebase/firebase-functions/releases/tag/v4.5.0 (PR: #1423) and this issue can be closed.

  5. moved this from Needs Acknowledgment to Triaged in [Cloud] Extensions + Functionson May 7, 2025
  6. cabljac commented on Jun 5, 2025

    @cabljac
    Contributor

    Closing as complete, thanks @gustavopch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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