From 0149530d03e1343f6f3b07f6058ffb7d212b1336 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:25:57 +0100 Subject: [PATCH 01/12] Update Pages bindings to reflect new dashboard, correct queues documentation, and add Hyperdrive details --- src/content/docs/pages/functions/bindings.mdx | 86 ++++++++++++------- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index c30cc22d7bd7e00..3c21cc3ada65df4 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -27,11 +27,11 @@ To configure a KV namespace binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > **Settings** > **Functions** > **KV namespace bindings** > **Add binding**. -4. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. -5. Give your binding a name under **Variable name**. -6. Under **KV namespace**, select your desired namespace. You must repeat steps 5 and 6 for both the **Production** and **Preview** environments. -7. Redeploy your project for the binding to take effect. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Bindings** > **Add** > **KV namespace**. +4. Give your binding a name under **Variable name**. +5. Under **KV namespace**, select your desired namespace. +6. Redeploy your project for the binding to take effect. Below is an example of how to use KV in your Function. In the following example, your KV namespace binding is called `TODO_LIST` and you can access the binding in your Function code on `context.env`: @@ -86,10 +86,10 @@ To configure a Durable Object binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > **Settings** > **Functions** > **Durable Object bindings** > **Add binding**. -4. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Bindings** > **Add binding** > **Durable Object**. 5. Give your binding a name under **Variable name**. -6. Under **Durable Object namespace**, select your desired namespace. You must repeat steps 5 and 6 for both the **Production** and **Preview** environments. +6. Under **Durable Object namespace**, select your desired namespace. 7. Redeploy your project for the binding to take effect. Below is an example of how to use Durable Objects in your Function. In the following example, your DO binding is called `DURABLE_OBJECT` and you can access the binding in your Function code on `context.env`: @@ -149,10 +149,10 @@ To configure a R2 bucket binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > **Settings** > **Functions** > **R2 bucket bindings** > **Add binding**. -4. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Bindings** > **Add binding** > **R2 bucket**. 5. Give your binding a name under **Variable name**. -6. Under **R2 bucket**, select your desired R2 bucket. You must repeat steps 5 and 6 for both the **Production** and **Preview** environments. +6. Under **R2 bucket**, select your desired R2 bucket. 7. Redeploy your project for the binding to take effect. Below is an example of how to use R2 buckets in your Function. In the following example, your R2 bucket binding is called `BUCKET` and you can access the binding in your Function code on `context.env`: @@ -220,10 +220,10 @@ To configure a D1 database binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > **Settings** > **Functions** > **D1 database bindings** > **Add binding**. -4. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Bindings** > **Add binding**> **D1 database bindings**. 5. Give your binding a name under **Variable name**. -6. Under **D1 database**, select your desired D1 database. You must repeat steps 5 and 6 for both the **Production** and **Preview** environments. +6. Under **D1 database**, select your desired D1 database. 7. Redeploy your project for the binding to take effect. Below is an example of how to use D1 in your Function. In the following example, your D1 database binding is `NORTHWIND_DB` and you can access the binding in your Function code on `context.env`: @@ -296,9 +296,10 @@ To configure a Vectorize index binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. 3. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. -4. Select your Pages project > **Settings** > **Functions** > **Vectorize index bindings** > **Add binding**. +4. Select your Pages project > **Settings**. +4. Select your Pages environment > **Bindings** > **Add** > **Vectorize index**. 5. Give your binding a name under **Variable name**. -6. Under **Vectorize index**, select your desired Vectorize index. You must repeat steps 5 and 6 for both the **Production** and **Preview** environments. +6. Under **Vectorize index**, select your desired Vectorize index. 7. Redeploy your project for the binding to take effect. ### Use Vectorize index bindings @@ -433,8 +434,8 @@ To configure a Workers AI binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > **Settings** > **Functions** > **Workers AI bindings** > **Add binding**. -4. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Bindings** > **Add** > **Workers AI**. 5. Give your binding a name under **Variable name**. 6. Redeploy your project for the binding to take effect. @@ -505,10 +506,10 @@ To configure a Service binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > **Settings** > **Functions** > **Service bindings** > **Add binding**. -4. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Functions** > **Add** > **Service binding**. 5. Give your binding a name under **Variable name**. -6. Under **Service**, select your desired Worker. You must repeat steps 5 and 6 for both the **Production** and **Preview** environments. +6. Under **Service**, select your desired Worker. 7. Redeploy your project for the binding to take effect. Below is an example of how to use Service bindings in your Function. In the following example, your Service binding is called `SERVICE` and you can access the binding in your Function code on `context.env`: @@ -560,10 +561,10 @@ To configure a queue producer binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > **Settings** > **Functions** > **Queue Producers bindings** > **Add binding**. -4. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Functions** > **Add** > **Queue**. 5. Give your binding a name under **Variable name**. -6. Under **Dataset**, input your desired dataset. You must repeat steps 5 and 6 for both the **Production** and **Preview** environments. +6. Under **Queue**, select your desired queue. 7. Redeploy your project for the binding to take effect. Below is an example of how to use a queue producer binding in your Function. In this example, the binding is named `MY_QUEUE` and you can access the binding in your Function code on `context.env`:: @@ -610,7 +611,12 @@ If using a queue producer binding with a Pages Function, you will be able to sen :::note -PostgreSQL drivers like [`Postgres.js`](https://github.com/porsager/postgres) depend on Node.js APIs and as such Functions with Hyperdrive config bindings must be [deployed with Node.js compatibility](/workers/runtime-apis/nodejs). +PostgreSQL drivers like [`Postgres.js`](https://github.com/porsager/postgres) depend on Node.js APIs. Pages Functions with Hyperdrive bindings must be [deployed with Node.js compatibility](/workers/runtime-apis/nodejs). + +```toml title="wrangler.toml" +compatibility_flags = [ "nodejs_compat" ] +compatibility_date = "2024-09-23" +``` ::: @@ -618,6 +624,15 @@ PostgreSQL drivers like [`Postgres.js`](https://github.com/porsager/postgres) de To bind your Hyperdrive config to your Pages Function, you can configure a Hyperdrive binding in [`wrangler.toml`](/pages/functions/wrangler-configuration/#hyperdrive) or the Cloudflare dashboard. +To configure a Hyperdrive binding via the Cloudflare dashboard: +1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. +2. In **Account Home**, select **Workers & Pages**. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Bindings** > **Add** > **Hyperdrive**. +5. Give your binding a name under **Variable name**. +6. Under **Hyperdrive configuration**, select your desired configuration. +7. Redeploy your project for the binding to take effect. + Below is an example of how to use Hyperdrive in your Function. In the following example, your Hyperdrive config is named `HYPERDRIVE` and you can access the binding in your Function code on `context.env`: @@ -668,7 +683,11 @@ export const onRequest: PagesFunction = async (context) => { }; ``` - + + +### Interact with your Hyperdrive binding locally + +To interact with your Hyperdrive binding locally, use the `wrangler.toml` file to configure your Hyperdrive binding. Then, run [`npx wrangler pages dev `](/workers/wrangler/commands/#dev-1). ## Analytics Engine @@ -680,10 +699,10 @@ To configure an Analytics Engine binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > **Settings** > **Functions** > **Analytics Engine bindings** > **Add binding**. -4. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Bindings** > **Add** > **Analytics engine**. 5. Give your binding a name under **Variable name**. -6. Under **Dataset**, input your desired dataset. You must repeat steps 5 and 6 for both the **Production** and **Preview** environments. +6. Under **Dataset**, input your desired dataset. 7. Redeploy your project for the binding to take effect. Below is an example of how to use an Analytics Engine binding in your Function. In the following example, the binding is called `ANALYTICS_ENGINE` and you can access the binding in your Function code on `context.env`: @@ -740,8 +759,8 @@ To configure an environment variable via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > **Settings** > **Environment variables**. -4. Selecting **Add variables** under **Production** and/or **Preview**. +3. Select your Pages project > **Settings**. +4. Select your Pages environment > **Variables and Secrets** > **Add** . 5. After setting a variable name and value, select **Save**. Below is an example of how to use environment variables in your Function. The environment variable in this example is `ENVIRONMENT` and you can access the environment variable on `context.env`: @@ -797,8 +816,9 @@ To add secrets to your Pages project: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. -3. Select your Pages project > select **Settings** > **Environment variables**. -4. Selecting **Add variables** under **Production** and/or **Preview**. +3. Select your Pages project > select **Settings**. +4. Select your Pages environment > **Variables and Secrets** > **Add**. +5. Set a variable name and value. 5. Select **Encrypt** to create your secret. 6. Select **Save**. From f1fa3c1b6612fec2d524982ccf6d7ee873d61cd8 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:54:30 +0100 Subject: [PATCH 02/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index 3c21cc3ada65df4..166b943788428a3 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -29,9 +29,9 @@ To configure a KV namespace binding via the Cloudflare dashboard: 2. In **Account Home**, select **Workers & Pages**. 3. Select your Pages project > **Settings**. 4. Select your Pages environment > **Bindings** > **Add** > **KV namespace**. -4. Give your binding a name under **Variable name**. -5. Under **KV namespace**, select your desired namespace. -6. Redeploy your project for the binding to take effect. +5. Give your binding a name under **Variable name**. +6. Under **KV namespace**, select your desired namespace. +7. Redeploy your project for the binding to take effect. Below is an example of how to use KV in your Function. In the following example, your KV namespace binding is called `TODO_LIST` and you can access the binding in your Function code on `context.env`: From 6ccf0ee8b0eeb1e574c14eca553955e7521d5cef Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:56:28 +0100 Subject: [PATCH 03/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index 166b943788428a3..8cb78a977c11c99 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -819,8 +819,8 @@ To add secrets to your Pages project: 3. Select your Pages project > select **Settings**. 4. Select your Pages environment > **Variables and Secrets** > **Add**. 5. Set a variable name and value. -5. Select **Encrypt** to create your secret. -6. Select **Save**. +6. Select **Encrypt** to create your secret. +7. Select **Save**. You use secrets the same way as environment variables. When setting secrets with Wrangler or in the Cloudflare dashboard, it needs to be done before a deployment that uses those secrets. For more guidance, refer to [Environment variables](#environment-variables). From b292cd19d72bb1e8f0ee7c356b61af8ad3721155 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:57:35 +0100 Subject: [PATCH 04/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index 8cb78a977c11c99..a3972efda590090 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -297,7 +297,7 @@ To configure a Vectorize index binding via the Cloudflare dashboard: 2. In **Account Home**, select **Workers & Pages**. 3. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. 4. Select your Pages project > **Settings**. -4. Select your Pages environment > **Bindings** > **Add** > **Vectorize index**. +5. Select your Pages environment > **Bindings** > **Add** > **Vectorize index**. 5. Give your binding a name under **Variable name**. 6. Under **Vectorize index**, select your desired Vectorize index. 7. Redeploy your project for the binding to take effect. From ae042bcb8d9f7f77e91f1e170aae9bbf55eab8a9 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:57:56 +0100 Subject: [PATCH 05/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index a3972efda590090..1eebb842b894c28 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -298,7 +298,7 @@ To configure a Vectorize index binding via the Cloudflare dashboard: 3. Choose whether you would like to set up the binding in your **Production** or **Preview** environment. 4. Select your Pages project > **Settings**. 5. Select your Pages environment > **Bindings** > **Add** > **Vectorize index**. -5. Give your binding a name under **Variable name**. +6. Give your binding a name under **Variable name**. 6. Under **Vectorize index**, select your desired Vectorize index. 7. Redeploy your project for the binding to take effect. From c620207d3c6268bb3ae6c6144a24fbc788b4503b Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:58:17 +0100 Subject: [PATCH 06/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index 1eebb842b894c28..cd401d6a0243b2f 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -299,7 +299,7 @@ To configure a Vectorize index binding via the Cloudflare dashboard: 4. Select your Pages project > **Settings**. 5. Select your Pages environment > **Bindings** > **Add** > **Vectorize index**. 6. Give your binding a name under **Variable name**. -6. Under **Vectorize index**, select your desired Vectorize index. +7. Under **Vectorize index**, select your desired Vectorize index. 7. Redeploy your project for the binding to take effect. ### Use Vectorize index bindings From f3dc9e61fc0caf62570abeb0f43cd2b1ca5daa1f Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Thu, 10 Oct 2024 12:46:32 +0100 Subject: [PATCH 07/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index cd401d6a0243b2f..8b5156e81aa5e14 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -300,7 +300,7 @@ To configure a Vectorize index binding via the Cloudflare dashboard: 5. Select your Pages environment > **Bindings** > **Add** > **Vectorize index**. 6. Give your binding a name under **Variable name**. 7. Under **Vectorize index**, select your desired Vectorize index. -7. Redeploy your project for the binding to take effect. +8. Redeploy your project for the binding to take effect. ### Use Vectorize index bindings From 93c68854dc86ef895e49fe2e11ea56276d921a5e Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:35:25 +0100 Subject: [PATCH 08/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index 8b5156e81aa5e14..15f051ad7ff1b03 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -507,7 +507,7 @@ To configure a Service binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. 3. Select your Pages project > **Settings**. -4. Select your Pages environment > **Functions** > **Add** > **Service binding**. +4. Select your Pages environment > **Bindings** > **Add** > **Service binding**. 5. Give your binding a name under **Variable name**. 6. Under **Service**, select your desired Worker. 7. Redeploy your project for the binding to take effect. From 2cb2b89619da319672287f80e0a938b6ba135021 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:01:42 +0100 Subject: [PATCH 09/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index 15f051ad7ff1b03..ffd36d3aacbf79f 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -87,7 +87,7 @@ To configure a Durable Object binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. 3. Select your Pages project > **Settings**. -4. Select your Pages environment > **Bindings** > **Add binding** > **Durable Object**. +4. Select your Pages environment > **Bindings** > **Add** > **Durable Object**. 5. Give your binding a name under **Variable name**. 6. Under **Durable Object namespace**, select your desired namespace. 7. Redeploy your project for the binding to take effect. From df9313739422e902e389b8162680c9533d63a0ad Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:02:04 +0100 Subject: [PATCH 10/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index ffd36d3aacbf79f..97a1376fd72fe53 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -150,7 +150,7 @@ To configure a R2 bucket binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. 3. Select your Pages project > **Settings**. -4. Select your Pages environment > **Bindings** > **Add binding** > **R2 bucket**. +4. Select your Pages environment > **Bindings** > **Add** > **R2 bucket**. 5. Give your binding a name under **Variable name**. 6. Under **R2 bucket**, select your desired R2 bucket. 7. Redeploy your project for the binding to take effect. From 16de7ad573aa158d00a419495b6d277ba87f31ca Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:02:24 +0100 Subject: [PATCH 11/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index 97a1376fd72fe53..2f0ad6743e9eaf8 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -221,7 +221,7 @@ To configure a D1 database binding via the Cloudflare dashboard: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. 2. In **Account Home**, select **Workers & Pages**. 3. Select your Pages project > **Settings**. -4. Select your Pages environment > **Bindings** > **Add binding**> **D1 database bindings**. +4. Select your Pages environment > **Bindings** > **Add**> **D1 database bindings**. 5. Give your binding a name under **Variable name**. 6. Under **D1 database**, select your desired D1 database. 7. Redeploy your project for the binding to take effect. From 8ad0f4e17476c9a34118b608b78aee5937255390 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:09:41 +0100 Subject: [PATCH 12/12] Update src/content/docs/pages/functions/bindings.mdx --- src/content/docs/pages/functions/bindings.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index 2f0ad6743e9eaf8..833d69aae99c0e4 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -687,7 +687,7 @@ export const onRequest: PagesFunction = async (context) => { ### Interact with your Hyperdrive binding locally -To interact with your Hyperdrive binding locally, use the `wrangler.toml` file to configure your Hyperdrive binding. Then, run [`npx wrangler pages dev `](/workers/wrangler/commands/#dev-1). +To interact with your Hyperdrive binding locally, you must provide a local connection string to your database that your Pages project will connect to directly. You can set an environment variable `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_` with the connection string of the database, or use the `wrangler.toml` file to configure your Hyperdrive binding with a `localConnectionString` as specified in [Hyperdrive documentation for local development](/hyperdrive/configuration/local-development/). Then, run [`npx wrangler pages dev `](/workers/wrangler/commands/#dev-1). ## Analytics Engine