Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/content/docs/workers/platform/limits.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ You can measure your Worker's startup time by deploying it to Cloudflare using [

If you are having trouble staying under this limit, consider [profiling using DevTools](/workers/observability/dev-tools/) locally to learn how to optimize your code.

When you attempt to deploy a Worker using the [Wrangler CLI](/workers/wrangler/), but your deployment is rejected because your Worker exceeds the maximum startup time, Wrangler will automatically generate a CPU profile that you can import into Chrome DevTools or open directly in VSCode. You can use this to learn what code in your Worker uses large amounts of CPU time at startup. Refer to [`wrangler check startup`](/workers/wrangler/commands/#startup) for more details.

<Render file="limits_increase" />

---
Expand Down
26 changes: 26 additions & 0 deletions src/content/docs/workers/wrangler/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Wrangler offers a number of commands to manage your Cloudflare Workers.
- [`cert`](#cert) - Manage certificates used for mTLS and Certificate Authority (CA) chain connections.
- [`types`](#types) - Generate types from bindings and module rules in configuration.
- [`telemetry`](#telemetry) - Configure whether Wrangler can collect anonymous usage data.
- [`check`](#check) - Validate your Worker.

:::note

Expand Down Expand Up @@ -1966,3 +1967,28 @@ This will resolve the global status set by `wrangler telemetry disable / enable`
```txt
wrangler telemetry status
```

<Render file="wrangler-commands/global-flags" product="workers" />

---

## `check`

### `startup`

Generate a CPU profile of your Worker's startup phase.

After you run `wrangler check startup`, you can import the profile into Chrome DevTools or open it directly in VSCode to view a flamegraph of your Worker's startup phase. Additionally, when a Worker deployment fails with a startup time error Wrangler will automatically generate a CPU profile for easy investigation.

```sh
wrangler check startup
```

- `--args` <Type text="string" /> <MetaInfo text="optional" />
- To customise the way `wrangler check startup` builds your Worker for analysis, provide the exact arguments you use when deploying your Worker with `wrangler deploy`, or your Pages project with `wrangler pages functions build`. For instance, if you deploy your Worker with `wrangler deploy --no-bundle`, you should use `wrangler check startup --args="--no-bundle"` to profile the startup phase.
- `--worker` <Type text="string" /> <MetaInfo text="optional" />
- If you don't use Wrangler to deploy your Worker, you can use this argument to provide a Worker bundle to analyse. This should be a file path to a serialized multipart upload, with the exact same format as [the API expects](/api/resources/workers/subresources/scripts/methods/update/).
- `--pages` <Type text="boolean" /> <MetaInfo text="optional" />
- If you don't use a Wrangler config file with your Pages project (i.e. a Wrangler config file containing `pages_build_output_dir`), use this flag to force `wrangler check startup` to treat your project as a Pages project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identified issues

  • Vale Style Guide - (cloudflare.LatinTerms-warning) Use 'that is' instead of 'i.e.', but consider rewriting the sentence.

Proposed fix

Suggested change
- If you don't use a Wrangler config file with your Pages project (i.e. a Wrangler config file containing `pages_build_output_dir`), use this flag to force `wrangler check startup` to treat your project as a Pages project.
- If you don't use a Wrangler config file with your Pages project (that is, a Wrangler config file containing `pages_build_output_dir`), use this flag to force `wrangler check startup` to treat your project as a Pages project.

I replaced 'i.e.' with 'that is' as per the style guide's recommendation. This change improves clarity and adheres to the style guide without altering the meaning of the sentence.


<Render file="wrangler-commands/global-flags" product="workers" />
Loading