Skip to content

[wrangler] Add hyperdrive planetscale signature command - #15065

Open
mtlemilio wants to merge 1 commit into
cloudflare:mainfrom
mtlemilio:hyperdrive-create-planetscale-database
Open

[wrangler] Add hyperdrive planetscale signature command#15065
mtlemilio wants to merge 1 commit into
cloudflare:mainfrom
mtlemilio:hyperdrive-create-planetscale-database

Conversation

@mtlemilio

@mtlemilio mtlemilio commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #SQC-896.

In June we released an evolution to our partnership with PlanetScale: https://developers.cloudflare.com/changelog/post/2026-06-18-planetscale-databases-cloudflare-billing/

From the UI customers can create PlanetScale databases that are billed to their Cloudflare account. This change in Wrangler allows us to integrate the Wrangler CLI with the PlanetScale CLI by passing the relevant credentials. This supports an agentic/CLI workflow, in addition to the UI based flow that is currently available.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because:

A picture of a cute animal (not mandatory, but encouraged)


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 57644b4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Minor
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another 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 +190 to +202
export async function createDatabaseSignature(
config: Config,
integration: string
): Promise<CreateDatabaseSignature> {
const accountId = await requireAuth(config);
return await fetchResult(
config,
`/accounts/${accountId}/hyperdrive/integrationsOperations/${integration}/createDatabaseSignature`,
{
method: "POST",
}
);
}

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.

🟡 New Hyperdrive API call bypasses the required Cloudflare SDK

The new signing request talks to the Cloudflare API by hand-building a URL and calling the raw REST endpoint (fetchResult at packages/wrangler/src/hyperdrive/client.ts:195-201) instead of the official Cloudflare TypeScript SDK that the repository requires for all API access, so the call is untyped and can rely on undocumented endpoints.
Impact: Contributors reading the code get an unsupported pattern, and API changes will not be caught by types.

Repository rule and current code path

The root AGENTS.md anti-patterns list states: "Direct Cloudflare REST API calls → use the Cloudflare TypeScript SDK", and packages/wrangler/CONTRIBUTING.md ("Integration with Cloudflare REST API") repeats that the SDK, set up for every command handler, should be preferred. The new createDatabaseSignature() builds /accounts/${accountId}/hyperdrive/integrationsOperations/${integration}/createDatabaseSignature and posts via fetchResult. Note the rest of packages/wrangler/src/hyperdrive/client.ts predates the rule and uses the same pattern, so this may be an accepted deviation if the endpoint is not exposed by the SDK.

Open in Devin Review

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The underlying API endpoint hasn't been released yet. But when it is, we will update this code to use the generated Typescript SDK.

@workers-devprod
workers-devprod requested review from a team and penalosa and removed request for a team August 6, 2026 17:28
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/hyperdrive-planetscale-signature.md: [@cloudflare/wrangler]
  • packages/wrangler/src/tests/hyperdrive.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/hyperdrive/client.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/hyperdrive/planetscale.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/index.ts: [@cloudflare/wrangler]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants