Cloudflare
Connect
Polylane reads your account and sends Workers issues and alerts to itself.
Connect Cloudflare from the terminal. Pass --help for the flags Cloudflare accepts, plus --no-browser for headless environments.
polylane cloud connect --provider cloudflareAccount-owned API token with read access.
Connect your Cloudflare account with an account-owned API token. The token reads your resources and lets Polylane send Workers issues and alerts to itself. You do not set up anything in Cloudflare: Polylane creates a Workers Issues automation in each account that it connects, so each new or recurring Workers issue becomes a Polylane issue and an investigation. When the fix is code, it arrives as a pull request for you to review. Polylane encrypts the token before it stores it, and the agent never sees it.
You can also send Workers issues to Polylane from an account that you do not connect. See Send Workers issues without connecting below.
- Click Create read-only token above, or Create API token in the connection form. Either link opens the Cloudflare account API token screen with every permission Polylane needs selected.
- Select the account to connect. You must be a Super Administrator on that account to create an account-owned token.
- Do not change the selected permissions. Click Review token, then Create token. Sync and agent tools need the full set, and a missing permission causes partial failures.
- Copy the token and paste it into Polylane. Leave Create Workers alerts on to get default alerts for your Workers.
- Polylane checks the token and starts the first sync. One token connects every Cloudflare account that it can read, each as its own connection.
You must be on the Workers Paid plan for full resource discovery.
On connect, Polylane creates these items in each account that the token can read:
- A webhook destination named "Polylane alerts".
- A notification policy and a Workers Issues automation that send each new or recurring Workers issue to that destination. The automation is for the full account: it covers each Worker that has Workers Issues turned on, also the Workers that you deploy later.
- When Create Workers alerts is on, a second notification policy and three Workers Observability alerts:
Polylane-Workers-Exceptions,Polylane-Workers-CPU-ExceededandPolylane-Workers-Memory-Exceeded.
Connect Cloudflare from a CI job or any other environment without a browser.
Connecting Cloudflare needs no browser: the same endpoint the console calls fits in a CI job. One authenticated POST creates the connection and starts the first sync.
Prerequisites
- A Polylane API key with the
cloud_accounts:writeandcloud_accounts:readscopes. See API keys and OAuth. - Your workspace ID, which starts with
ws_. Read it fromGET /v1/workspaceswith the same key. - A Cloudflare account-owned API token. The Create read-only token link above pre-selects every permission Polylane needs.
Create the connection
curl -X POST https://api.polylane.com/v1/cloud_accounts \
-H "x-api-key: $POLYLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "cloudflare",
"workspaceId": "ws_0abc123",
"token": "<cloudflare-api-token>",
"readOnly": true
}'
One call connects every Cloudflare account the token can reach, each as its own connection.
readOnlyrecords that the token was created read-only; leave it out (orfalse) for a token that can write.createMonitoringAlarms(optional, defaulttrue) controls the three default Workers Observability alerts.
The response lists what was connected, with the first sync already running. Trimmed to the two fields the rest of the flow reads:
{
"success": true,
"result": {
"provider": "cloudflare",
"accounts": [{ "id": "acc_34gky74ibc92h8t2efn8csrh", "status": "syncing" }],
"failures": []
}
}
An account that is already connected lands in failures instead of accounts, so repeating the call never duplicates a connection.
Wait for the first sync
Poll each returned account by its id until status reaches ready (new on registration, syncing while resources stream in):
until [ "$(curl -s "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY" | jq -r '.result.status')" = "ready" ]; do
sleep 15
done
Give the loop a deadline so a failed connect fails the job instead of hanging it. Once the account is ready, its resources are in the topology and Polylane has started its first check.
Disconnect from the API
Deleting the connection stops every sync and check and deletes the credentials Polylane held. The call needs the cloud_accounts:delete scope:
curl -X DELETE "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY"
Then revoke the Cloudflare credential on the provider side, as described under Disconnecting.
How it works
Infrastructure graph
Polylane maps Workers with their routes, domains, bindings, schedules and builds, and the resources they use: KV, R2, D1, Durable Objects, Queues, Workflows, Hyperdrive, Vectorize, AI Gateway, Containers, Pages, Pipelines and Secrets Store. It also maps zones, tunnels, Access applications, load balancers, certificates, Logpush jobs, Spectrum apps and other account resources. Non-production Workers stay out of the graph unless you turn on monitoring for preview deployments.
Every 15 minutes, Polylane reads the last hour of the Cloudflare audit log. When it finds a change to a mapped resource type, it syncs the account again, at most once an hour. You can also sync the account from its page.
Deploys and changes
The same audit log read records Worker deployments, Worker versions, Pages deployments and Containers application updates as deploys. Agents compare these deploys with errors when they look for a cause.
Metrics, logs and checks
Polylane reads Cloudflare GraphQL Analytics and Workers Observability logs and traces. Every 30 minutes by default, account checks look at Worker error rate, wall time, memory resets and payload-limit errors, Durable Object errors, overloads and resets, D1 rows read, Workers AI capacity, Container start failures, failed Workflow instances, and destructive changes in the audit log. Each saved query in Workers Observability also becomes a check. You can change the check frequency in the account settings.
Alerts
Each Workers issue and each Polylane Workers alert reaches Polylane through the webhook destination. You can send your own Cloudflare notifications to the same destination. Each alert becomes an issue, and a new issue starts an investigation. Repeats of the same Workers issue go to the same issue. Polylane sets the thresholds of its three alerts from the p99 of the last seven days, and adjusts them over time.
Agents and writes
During an investigation, agents query telemetry, traces, GraphQL Analytics, Workers Issues, AI Gateway logs, Workflow instances and deployments. The account starts as Read-only in Polylane. A workspace admin can turn it off, so that agents can request Cloudflare API writes. Each write needs a safety review and your approval before it runs. The read-only token itself refuses writes outside notifications and Workers Observability.
Workers issues
Workers Issues is Cloudflare's error monitoring for Workers. It groups uncaught exceptions, failed invocations, 5xx responses and logged errors from a Worker into issues. Polylane gets each new or recurring Workers issue through an automation, opens a Polylane issue for it, and starts an investigation. Repeats of the same Workers issue go to the same Polylane issue.
Turn on Issues for your Workers
The automation only sends issues from Workers that have Issues turned on. Turn it on for each Worker in its Wrangler configuration file, then deploy the Worker:
{
"observability": {
"issues": {
"enabled": true
}
}
}
You can also select Enable issues on the Worker's Issues page in the Cloudflare dashboard. If you deploy with Wrangler, also set the value in the configuration file. If you do not, the next deployment turns Issues off. Issues needs Wrangler 4.134.0 or later, and it only processes new traffic.
Connected accounts
When you connect an account, Polylane creates the automation for you. It covers each Worker that has Issues on, now and in the future. You do not have to do anything for each Worker except turn on Issues. To see the automation, open Issues > Automations on a Worker in the Cloudflare dashboard. Its name starts with Polylane.
Send Workers issues without connecting
You can send Workers issues to Polylane from a Cloudflare account that you do not connect, for example an account that belongs to a different team. Polylane opens an issue and investigates it with your other connected tools and your code. Connect the account later to let agents also read the Worker's logs, traces and deploys.
- In the Polylane console, open Settings > Telemetry Tokens and create a token. Copy it.
- In the Cloudflare dashboard, open a Worker that has Issues on, then go to Issues > Automations > Add automation.
- Select a trigger. To send each issue as it starts, use an occurrence threshold of 1.
- Create a destination. Select Generic Webhook and enter these values:
- Name:
Polylane - URL:
https://sinks.polylane.com/v1/cloudflare - Secret: the telemetry token from step 1
- Name:
- Select Create destination, turn on Enabled, and select Create.
Cloudflare sends the secret with each webhook, and Polylane uses it to find your workspace. You can use the same destination for other Cloudflare notifications, such as Workers Observability alerts or health checks. Each alert becomes an issue in Polylane.
If you connect the account later, Polylane creates its own automation. Delete the automation that you created, so that each Workers issue reaches Polylane only once.
Permissions
The link creates an account-owned token: a service principal that keeps working when the person who created it leaves the account. It requests read access across the account:
- Developer Platform: Workers, KV, R2, D1, Queues, Basin Pipelines, Basin Catalog, Hyperdrive, Durable Objects, K2 streams, Containers, Secrets Store, Artifacts and more.
- AI and Machine Learning: Workers AI, AI Gateway, AI Search, Vectorize, Browser Run.
- DNS and Zones: DNS, zone settings, registrar, DNS firewall.
- Network Services: Load Balancing, Magic Transit and WAN, Spectrum, tunnels.
- App Security: WAF, rulesets, DDoS, bot management, page rules, certificates.
- Zero Trust and Cloudflare One.
- Cache, Email, Media, Rules, Analytics and Logs.
It also requests edit on Notifications and Workers Observability. Polylane uses these two to create its webhook destination, notification policies, Workers Issues automation and Workers alerts, and to remove them when you disconnect.
The token cannot deploy, change configuration, roll back, change billing, manage API tokens, or write SSO, SCIM or OAuth identity settings.
Disconnecting
When you disconnect the account in Polylane, Polylane deletes its webhook destination, notification policies, Workers Issues automation and Workers alerts, and stops all sync and checks.
Then revoke the API token in your Cloudflare dashboard under Manage Account → API Tokens.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Everything Polylane set up in Cloudflare is removed as well; nothing is left behind.
polylane cloud disconnect <id>Tools
17Operations agents can perform in threads.
Supported resources
51Resource types that show up in your infrastructure graph.