Skip to content

Support hyperdrive and worker version metadata bindings#6689

Open
Ernxst wants to merge 1 commit intoanomalyco:devfrom
Ernxst:dev
Open

Support hyperdrive and worker version metadata bindings#6689
Ernxst wants to merge 1 commit intoanomalyco:devfrom
Ernxst:dev

Conversation

@Ernxst
Copy link
Copy Markdown
Contributor

@Ernxst Ernxst commented Apr 3, 2026

This PR adds hyperdrive and worker version metadata to the supported bindings mappings. (Closes #6690)

I tried to work around this with this wrapper component that I thought was clever:

import type { WorkerVersionMetadata } from "@cloudflare/workers-types";

export class VersionMetadata extends $util.ComponentResource {
  #resourceName: string;

  constructor(name: string) {
    super(__pulumiType, name);
    this.#resourceName = name;
  }

  getSSTLink() {
    return {
      // Placeholders for type generation
      properties: {
        id: "",
        tag: "",
        timestamp: "",
      } satisfies WorkerVersionMetadata,
      include: [
        {
          type: "cloudflare.binding",
          binding: "versionMetadata",
          properties: {
            type: "version_metadata",
            name: this.#resourceName,
          },
        },
      ],
    };
  }
}

const __pulumiType = "sst:cloudflare:VersionMetadata";
// @ts-expect-error
VersionMetadata.__pulumiType = __pulumiType;

It worked as expected, binding the worker version metadata to the worker, but the type generation produced:

// cloudflare 
import * as cloudflare from "@cloudflare/workers-types";
declare module "sst" {
  export interface Resource {
    "Api": cloudflare.Service
    "Hyperdrive": cloudflare.
    "MailJobDLQ": cloudflare.Queue
    "MailJobQueue": cloudflare.Queue
    "VersionMetadata": cloudflare.
  }
}

Where the two bindings not supported are generated incomplete as they're not in the mapping. Naming in the mapping can be changed if needed.

@bachiitter
Copy link
Copy Markdown
Contributor

bachiitter commented Apr 5, 2026

exclude hyperdrive as it requires additional config it better to create a separate component for hyperdrive with config and binding like queue

#6683

@Ernxst
Copy link
Copy Markdown
Contributor Author

Ernxst commented Apr 5, 2026

I think they can both be components just wrapping pulumi equivalents, here's the same in alchemy - then sst.cloudflare.binding can be for referencing resources provisioned outside SST. Might be better to track both hyperdrive and version metadata in that PR you linked @bachiitter

@bachiitter
Copy link
Copy Markdown
Contributor

I think they can both be components just wrapping pulumi equivalents, here's the same in alchemy - then sst.cloudflare.binding can be for referencing resources provisioned outside SST. Might be better to track both hyperdrive and version metadata in that PR you linked @bachiitter

good point, i should have thought of it

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.

Hyperdrive and WorkerVersionMetadata produce invalid declaration files.

2 participants