Configuration (10)·续
namestringrequired- The name of your Pages project. Alphanumeric and dashes only.
pages_build_output_dirstringrequired- The path to your project's build output folder. For example:
./dist. compatibility_datestringrequired- A date in the form
yyyy-mm-dd, which will be used to determine which version of the Workers runtime is used. Refer to Compatibility dates. compatibility_flagsstring[] optional- A list of flags that enable features from upcoming features of the Workers runtime, usually used together with
compatibility_date. Refer to compatibility dates. send_metricsbooleanoptional- Whether Wrangler should send usage data to Cloudflare for this project. Defaults to
true. You can learn more about this in our data policy ↗︎. limitsLimits optional- Configures limits to be imposed on execution at runtime. Refer to Limits.
placementPlacement optional- Specify how Pages Functions should be located to minimize round-trip time. Refer to Smart Placement.
upload_source_mapsboolean- When
upload_source_mapsis set totrue, Wrangler will upload any server-side source maps part of your Pages project to give corrected stack traces in logs.
Non-inheritable keys
Non-inheritable keys are configurable at the top-level, but, if any one non-inheritable key is overridden for any environment (for example,[[env.production.kv_namespaces]]), all non-inheritable keys must also be specified in the environment configuration and overridden.
For example, this configuration will not work:
{
"$schema": "./node_modules/wrangler/config-schema.json",
"name": "my-pages-site",
"pages_build_output_dir": "./dist",
"kv_namespaces": [
{
"binding": "KV",
"id": "<NAMESPACE_ID>"
}
],
"vars": {
"API_KEY": "1234567asdf"
},
"env": {
"production": {
"vars": {
"API_KEY": "8901234bfgd"
}
}
}
}
"$schema" = "./node_modules/wrangler/config-schema.json"
name = "my-pages-site"
pages_build_output_dir = "./dist"
[[kv_namespaces]]
binding = "KV"
id = "<NAMESPACE_ID>"
[vars]
API_KEY = "1234567asdf"
[env.production.vars]
API_KEY = "8901234bfgd"
[[env.production.vars]] is set to override [vars]. Because of this [[kv_namespaces]] must also be overridden by defining [[env.production.kv_namespaces]].
This will work for local development, but will fail to validate when you try to deploy.
varsobjectoptional- A map of environment variables to set when deploying your Function. Refer to Environment variables.
d1_databasesobjectoptional- A list of D1 databases that your Function should be bound to. Refer to D1 databases.
durable_objectsobjectoptional- A list of Durable Objects that your Function should be bound to. Refer to Durable Objects.
hyperdriveobjectoptional- Specifies Hyperdrive configs that your Function should be bound to. Refer to Hyperdrive.
kv_namespacesobjectoptional- A list of KV namespaces that your Function should be bound to. Refer to KV namespaces.
queues.producersobjectoptional- Specifies Queues Producers that are bound to this Function. Refer to Queues Producers.
r2_bucketsobjectoptional- A list of R2 buckets that your Function should be bound to. Refer to R2 buckets.
vectorizeobjectoptional- A list of Vectorize indexes that your Function should be bound to. Refer to Vectorize indexes.
servicesobjectoptional- A list of service bindings that your Function should be bound to. Refer to service bindings.
analytics_engine_datasetsobjectoptional- Specifies analytics engine datasets that are bound to this Function. Refer to Workers Analytics Engine.
aiobjectoptional- Specifies an AI binding to this Function. Refer to Workers AI.
Limits
You can configure limits for your Pages project in the same way you can for Workers. Read this guide for more details.
Bindings
A binding enables your Pages Functions to interact with resources on the Cloudflare Developer Platform. Use bindings to integrate your Pages Functions with Cloudflare resources like KV, Durable Objects, R2, and D1. You can set bindings for both production and preview environments.
D1 databases
D1 is Cloudflare's serverless SQL database. A Function can query a D1 database (or databases) by creating a binding to each database for D1 Workers Binding API.
Note
When using Wrangler in the default local development mode, files will be written to local storage instead of the preview or production database. Refer to Local development for more details.
- Configure D1 database bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
- Interact with your D1 Database binding.
Durable Objects
Durable Objects provide low-latency coordination and consistent storage for the Workers platform.
- Configure Durable Object namespace bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
Caution
You must create a Durable Object Worker and bind it to your Pages project using the Cloudflare dashboard or your Pages project's Wrangler configuration file. You cannot create and deploy a Durable Object within a Pages project.
Durable Object bindings configured in a Pages project's Wrangler configuration file require the script_name key. For Workers, the script_name key is optional.
- Interact with your Durable Object namespace binding.
Environment variables
Environment variables are a type of binding that allow you to attach text strings or JSON values to your Pages Function.
- Configure environment variables via your Wrangler file the same way they are configured with Cloudflare Workers.
- Interact with your environment variables.
Hyperdrive
Hyperdrive bindings allow you to interact with and query any Postgres database from within a Pages Function.
- Configure Hyperdrive bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
KV namespaces
Workers KV is a global, low-latency, key-value data store. It stores data in a small number of centralized data centers, then caches that data in Cloudflare’s data centers after access.
Note
When using Wrangler in the default local development mode, files will be written to local storage instead of the preview or production namespace. Refer to Local development for more details.
- Configure KV namespace bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
- Interact with your KV namespace binding.
Queues Producers
Queues is Cloudflare's global message queueing service, providing guaranteed delivery and message batching. Queue Producers enable you to send messages into a queue within your Pages Function.
Note
You cannot currently configure a queues consumer with Pages Functions.
- Configure Queues Producer bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
- Interact with your Queues Producer binding.
R2 buckets
Cloudflare R2 Storage allows developers to store large amounts of unstructured data without the costly egress bandwidth fees associated with typical cloud storage services.
Note
When using Wrangler in the default local development mode, files will be written to local storage instead of the preview or production bucket. Refer to Local development for more details.
- Configure R2 bucket bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
- Interact with your R2 bucket bindings.
Vectorize indexes
A Vectorize index allows you to insert and query vector embeddings for semantic search, classification and other vector search use-cases.
- Configure Vectorize bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
Service bindings
A service binding allows you to call a Worker from within your Pages Function. Binding a Pages Function to a Worker allows you to send HTTP requests to the Worker without those requests going over the Internet. The request immediately invokes the downstream Worker, reducing latency as compared to a request to a third-party service. Refer to About Service bindings.
- Configure service bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
- Interact with your service bindings.
Analytics Engine Datasets
Workers Analytics Engine provides analytics, observability and data logging from Pages Functions. Write data points within your Pages Function binding then query the data using the SQL API.
- Configure Analytics Engine Dataset bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
- Interact with your Analytics Engine Dataset.
Workers AI
Workers AI allows you to run machine learning models, on the Cloudflare network, from your own code – whether that be from Workers, Pages, or anywhere via REST API.
Workers AI local development usage charges
Using Workers AI always accesses your Cloudflare account in order to run AI models and will incur usage charges even in local development.
Unlike other bindings, this binding is limited to one AI binding per Pages Function project.
- Configure Workers AI bindings via your Wrangler file the same way they are configured with Cloudflare Workers.
- Interact with your Workers AI binding.
Local development settings
The local development settings that you can configure are the same for Pages Functions and Cloudflare Workers. Read this guide for more details.
Source of truth
When used in your Pages Functions projects, your Wrangler file is the source of truth. You will be able to see, but not edit, the same fields when you log into the Cloudflare dashboard.
If you decide that you do not want to use a Wrangler configuration file for configuration, you can safely delete it and create a new deployment. Configuration values from your last deployment will still apply and you will be able to edit them from the dashboard.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/pages/functions/wrangler-configuration/#page","headline":"Configuration","description":"Configure Pages Functions settings using a Wrangler configuration file or the Cloudflare dashboard.","url":"https://developers.cloudflare.com/pages/functions/wrangler-configuration/","inLanguage":"en","image":"https://developers.cloudflare.com/pages/functions/wrangler-configuration/og.png?v=e0a97a11d71221a2","dateModified":"2026-06-25","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Guided tutorials to help you build and deploy projects on Cloudflare Pages. title: Tutorials image: https://developers.cloudflare.com/pages/tutorials/og.png?v=30eea3405733e2a4
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/pages/llms.txt
Use this file to discover all available pages before exploring further.
Docs