From 5ac4447bea2027ae969599fa2d3b1a09c54d17ce Mon Sep 17 00:00:00 2001 From: Diogo Ferreira Date: Wed, 27 Nov 2024 12:49:31 +0000 Subject: [PATCH 1/2] added wrangler local dev page --- .../workers/testing/local-development.mdx | 1 + .../workflows/build/events-and-parameters.mdx | 2 +- .../workflows/build/local-development.mdx | 57 +++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/content/docs/workflows/build/local-development.mdx diff --git a/src/content/docs/workers/testing/local-development.mdx b/src/content/docs/workers/testing/local-development.mdx index e19bf6719c02c7e..466d9a6b0dbba40 100644 --- a/src/content/docs/workers/testing/local-development.mdx +++ b/src/content/docs/workers/testing/local-development.mdx @@ -48,6 +48,7 @@ npx wrangler dev | Rate Limiting | ✅ | ✅ | | Service Bindings (multiple workers) | ✅ | ✅ | | Vectorize | ✅[^2] | ✅ | +| Workflows | ✅ | ❌ | With any bindings that are not supported locally, you will need to use the `--remote` command in wrangler, such as `wrangler dev --remote`. diff --git a/src/content/docs/workflows/build/events-and-parameters.mdx b/src/content/docs/workflows/build/events-and-parameters.mdx index 50c04d21b153800..9cbaacb195d46af 100644 --- a/src/content/docs/workflows/build/events-and-parameters.mdx +++ b/src/content/docs/workflows/build/events-and-parameters.mdx @@ -2,7 +2,7 @@ title: Events and parameters pcx_content_type: concept sidebar: - order: 10 + order: 6 --- diff --git a/src/content/docs/workflows/build/local-development.mdx b/src/content/docs/workflows/build/local-development.mdx new file mode 100644 index 000000000000000..9c270aea459099f --- /dev/null +++ b/src/content/docs/workflows/build/local-development.mdx @@ -0,0 +1,57 @@ +--- +title: Local Development +pcx_content_type: build +updated: 2024-11-27 +sidebar: + order: 8 + +--- + +Workflows support local development using [Wrangler](/workers/wrangler/install-and-update/), the command-line interface for Workers. Wrangler runs an emulated version of Workflows compared to the one that Cloudflare runs globally. + +## Prerequisites + +To develop locally with Workflows, you will need: + +- [Wrangler v3.89.0](https://blog.cloudflare.com/wrangler3/) or later. + +- Node.js version of `18.0.0` or later. Consider using a Node version manager like [Volta](https://volta.sh/) or [nvm](https://github.com/nvm-sh/nvm) to avoid permission issues and change Node versions. + +- If you are new to Workflows and/or Cloudflare Workers, refer to the [Workflows Guide](/workflows/get-started/guide/) to install `wrangler` and deploy their first Workflows. + +## Start a local development session + +Open your terminal and run the following commands to start a local development session: + +```sh +# Confirm we are using wrangler v3.89.0+ +npx wrangler --version +``` + +```sh output +⛅️ wrangler 3.89.0 +``` + +Start a local dev session + +```sh +# Start a local dev session: +npx wrangler dev +``` + +```sh output +------------------ +Your worker has access to the following bindings: +- Workflows: + - MY_WORKFLOW: MyWorkflow +⎔ Starting local server... +[wrangler:inf] Ready on http://127.0.0.1:8787/ +``` + +Local development sessions create a standalone, local-only environment that mirrors the production environment Workflows runs in so you can test your Workflows _before_ you deploy to production. + +Refer to the [`wrangler dev` documentation](/workers/wrangler/commands/#dev) to learn more about how to configure a local development session. + +## Known Issues + +Wrangler does not support `wrangler dev --remote`. From 1949ef1ebe9c01ed42287d4be0d74bfdcd0cad84 Mon Sep 17 00:00:00 2001 From: Diogo Ferreira Date: Wed, 27 Nov 2024 13:22:16 +0000 Subject: [PATCH 2/2] better know issues --- src/content/docs/workflows/build/local-development.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/docs/workflows/build/local-development.mdx b/src/content/docs/workflows/build/local-development.mdx index 9c270aea459099f..4a5a208fe0ed188 100644 --- a/src/content/docs/workflows/build/local-development.mdx +++ b/src/content/docs/workflows/build/local-development.mdx @@ -54,4 +54,6 @@ Refer to the [`wrangler dev` documentation](/workers/wrangler/commands/#dev) to ## Known Issues -Wrangler does not support `wrangler dev --remote`. +Wrangler does not support `npx wrangler dev --remote`. + +Wrangler Workflow commands `npx wrangler workflow [cmd]` are not supported for local development, as they target production API. \ No newline at end of file