Skip to content

Revert "docs(x402): deprecate x402 integration" - #2017

Merged
mattzcarey merged 1 commit into
cloudflare:mainfrom
mattzcarey:revert/pr-2000
Aug 3, 2026
Merged

mattzcarey merged 1 commit into
cloudflare:mainfrom
mattzcarey:revert/pr-2000

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

Reverts #2000.

This restores the x402 integration, examples, tests, and playground references removed by #2000.

Validation

  • pnpm install --frozen-lockfile
  • pnpm run check

Open in Devin Review

@changeset-bot

changeset-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6c5c320

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment on lines +41 to +42
const paidUrl = "http://localhost:5173/protected-route";
const res = await this.fetchWithPay(paidUrl, {});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Payments demo only works on a local machine and fails once deployed

The paid endpoint is requested at a fixed local development address (http://localhost:5173/protected-route at examples/x402/src/server.ts:41) instead of the address the app is actually running on, so the demo's "Fetch & Pay" button fails whenever the example is deployed.
Impact: Anyone who deploys this example to Cloudflare gets an error instead of the paid response.

Hardcoded dev origin in the agent's outbound fetch

PayAgent.fetchProtectedRoute (examples/x402/src/server.ts:33-49) builds paidUrl from a literal http://localhost:5173, which is only valid under vite dev. The example's deploy script (examples/x402/package.json:8) builds and deploys to Workers, where that origin is unreachable from the Durable Object, so this.fetchWithPay(paidUrl, {}) rejects and the UI shows a connection error. The agent has no access to the incoming request origin here, so the origin should be derived from configuration (e.g. an env var or a value passed from the callable) rather than hardcoded.

Prompt for agents
In examples/x402/src/server.ts, PayAgent.fetchProtectedRoute hardcodes http://localhost:5173/protected-route. This only works under `vite dev`; after `npm run deploy` the Durable Object cannot reach that origin and the demo fails. Consider passing the page origin from the client through the @callable method, or reading a configured base URL from env (with the localhost value only as a local default), and document it in the README.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@pkg-pr-new

pkg-pr-new Bot commented Aug 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@2017

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@2017

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@2017

create-think

npm i https://pkg.pr.new/create-think@2017

hono-agents

npm i https://pkg.pr.new/hono-agents@2017

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@2017

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@2017

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@2017

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@2017

commit: 6c5c320

@mattzcarey
mattzcarey merged commit 99cbb51 into cloudflare:main Aug 3, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant