> For AI agents: the complete Sanity documentation index is available at [https://www.sanity.io/docs/llms.txt](https://www.sanity.io/docs/llms.txt).

# Function timeout

Resolve timeout errors in Sanity Functions by adjusting the timeout duration.

When testing [Sanity Functions](https://www.sanity.io/docs/functions/functions-introduction) locally, you may see a timeout error. For example:

**npm**

```shell
npx sanity functions test log-event
› Error: Timeout: Function exceeded the 10-second time limit.
```

**pnpm**

```shell
pnpm dlx sanity functions test log-event
› Error: Timeout: Function exceeded the 10-second time limit.
```

**yarn**

```shell
yarn dlx sanity functions test log-event
› Error: Timeout: Function exceeded the 10-second time limit.
```

**bun**

```shell
bunx sanity functions test log-event
› Error: Timeout: Function exceeded the 10-second time limit.
```

By default, function execution time is set to 10 seconds, but may be configured down as low as 1 second and as high as 900 seconds (15 minutes).

You can experiment with different timeout values directly from the command line using the `--timeout` flag.

**npm**

```shell
npx sanity functions test log-event --timeout 15
```

**pnpm**

```shell
pnpm dlx sanity functions test log-event --timeout 15
```

**yarn**

```shell
yarn dlx sanity functions test log-event --timeout 15
```

**bun**

```shell
bunx sanity functions test log-event --timeout 15
```

This increases the timeout value to 15 seconds.

**Note:** Your functions will likely run faster locally than in the cloud. Today's modern machines far outpace the capabilities of cloud runners. So expect to add a bit of padding in your timeout value to compensate.

Once you establish an appropriate timeout value, update your blueprint file.

**sanity.blueprint.ts**

```typescript
import { defineBlueprint, defineDocumentFunction } from "@sanity/blueprints"

export default defineBlueprint({
  resources: [
    defineDocumentFunction({
      name: "log-event",
      timeout: 15, // Add your new timeout value
    }),
  ],
})

```

Now the next time you test your function locally it will read the new timeout value from the blueprint.

