[wrangler] Add hyperdrive planetscale signature command - #15065
Conversation
🦋 Changeset detectedLatest commit: 57644b4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
| 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", | ||
| } | ||
| ); | ||
| } |
There was a problem hiding this comment.
🟡 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
The underlying API endpoint hasn't been released yet. But when it is, we will update this code to use the generated Typescript SDK.
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
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.
A picture of a cute animal (not mandatory, but encouraged)