# tasks namespace    Stay organized with collections      Save and categorize content based on your preferences.

## Functions

| Function | Description |
| --- | --- |
| [onTaskDispatched(handler)](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.md#tasksontaskdispatched/index.html) | Creates a handler for tasks sent to a Google Cloud Tasks queue. |
| [onTaskDispatched(handler)](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.md#tasksontaskdispatched/index.html) | Creates a handler for tasks sent to a Google Cloud Tasks queue. |
| [onTaskDispatched(options, handler)](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.md#tasksontaskdispatched/index.html) | Creates a handler for tasks sent to a Google Cloud Tasks queue. |
| [onTaskDispatched(options, handler)](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.md#tasksontaskdispatched/index.html) | Creates a handler for tasks sent to a Google Cloud Tasks queue. |

## Interfaces

| Interface | Description |
| --- | --- |
| [AuthData](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.authdata.md#tasksauthdata_interface/index.html) | Metadata about the authorization used to invoke a function. |
| [RateLimits](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.ratelimits.md#tasksratelimits_interface/index.html) | How congestion control should be applied to the function. |
| [RetryConfig](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.retryconfig.md#tasksretryconfig_interface/index.html) | How a task should be retried in the event of a non-2xx return. |
| [TaskQueueFunction](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.taskqueuefunction.md#taskstaskqueuefunction_interface/index.html) | A handler for tasks. |
| [TaskQueueOptions](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.taskqueueoptions.md#taskstaskqueueoptions_interface/index.html) |  |

## Type Aliases

| Type Alias | Description |
| --- | --- |
| [Request](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.md#tasksrequest/index.html) | The request used to call a task queue function. |

## tasks.onTaskDispatched()

Creates a handler for tasks sent to a Google Cloud Tasks queue.

**Signature:**

```
export declare function onTaskDispatched<Args = any>(handler: (request: Request<Args> & {
    context: TaskContext;
}) => void | Promise<void>): TaskQueueFunction<Args>;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| handler | (request: Request<Args> & { context: TaskContext; }) => void \| Promise<void> | A callback to handle task requests. |

**Returns:**

[TaskQueueFunction](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.taskqueuefunction.md#taskstaskqueuefunction_interface/index.html) <Args>

A function you can export and deploy.

## tasks.onTaskDispatched()

Creates a handler for tasks sent to a Google Cloud Tasks queue.

**Signature:**

```
export declare function onTaskDispatched<Args = any>(handler: (request: Request<Args>) => void | Promise<void>): TaskQueueFunction<Args>;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| handler | (request: Request<Args>) => void \| Promise<void> | A callback to handle task requests. |

**Returns:**

A function you can export and deploy.

## tasks.onTaskDispatched()

Creates a handler for tasks sent to a Google Cloud Tasks queue.

**Signature:**

```
export declare function onTaskDispatched<Args = any>(options: TaskQueueOptions, handler: (request: Request<Args> & {
    context: TaskContext;
}) => void | Promise<void>): TaskQueueFunction<Args>;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| options | [TaskQueueOptions](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.taskqueueoptions.md#taskstaskqueueoptions_interface/index.html) | Configuration for the task queue or Cloud Function. |
| handler | (request: Request<Args> & { context: TaskContext; }) => void \| Promise<void> | A callback to handle task requests. |

**Returns:**

A function you can export and deploy.

## tasks.onTaskDispatched()

Creates a handler for tasks sent to a Google Cloud Tasks queue.

**Signature:**

```
export declare function onTaskDispatched<Args = any>(options: TaskQueueOptions, handler: (request: Request<Args>) => void | Promise<void>): TaskQueueFunction<Args>;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| options | [TaskQueueOptions](/content/docs/reference/functions/2nd-gen/node/firebase-functions.tasks.taskqueueoptions.md#taskstaskqueueoptions_interface/index.html) | Configuration for the task queue or Cloud Function. |
| handler | (request: Request<Args>) => void \| Promise<void> | A callback to handle task requests. |

**Returns:**

A function you can export and deploy.

## tasks.Request

The request used to call a task queue function.

**Signature:**

```
export type Request<T = any> = TaskContext & {
    data: T;
};
```
