anomalyco/sst · info

sst.linkable is deprecated. Use sst.Linkable.wrap instead.

Error message

sst.linkable is deprecated. Use sst.Linkable.wrap instead.

What it means

sst.linkable was the old API for making an arbitrary class instance participate in SST's resource-link system. It now emits a deprecation console.warn and forwards to the same behavior; developers should migrate to sst.Linkable.wrap, which is the supported public interface for defining custom links.

Source

Thrown at platform/src/components/link.ts:196

    input?: Input<any[]>,
  ): Output<T[]> {
    if (!input) return output([]);
    return output(input).apply((links) => {
      return links.filter(isLinkable).flatMap((l: Linkable) => {
        const link = l.getSSTLink();
        return (link.include || []).filter((i) => i.type === type) as T[];
      });
    });
  }

  /** @deprecated
   * Use sst.Linkable.wrap instead.
   */
  export function linkable<T>(
    obj: { new (...args: any[]): T },
    cb: (resource: T) => Definition,
  ) {
    console.warn("sst.linkable is deprecated. Use sst.Linkable.wrap instead.");
    obj.prototype.getSSTLink = function () {
      return cb(this);
    };
  }
}

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Replace the call with `sst.Linkable.wrap(MyClass, (m) => ({ properties: {...} }))` — signature and behavior are equivalent
  2. If the warning comes from a dependency, update that package to a version using sst.Linkable.wrap, or file/patch the import
  3. Silence-and-track interim: filter the console.warn during deploys while migration is pending (not recommended long-term)

Example fix

// before
sst.linkable(MyResource, (m) => ({ properties: { ref: m.ref } }))
// after
sst.Linkable.wrap(MyResource, (m) => ({ properties: { ref: m.ref } }))
Defensive patterns

Strategy: type-guard

Validate before calling

function usesLegacyLinkable(src: string): boolean {
  return /\bsst\.linkable\s*\(/.test(src);
}
// scan sst.config.ts and deps; if true, migrate to sst.Linkable.wrap before deploying

Type guard

function isLinkableCallable(obj: unknown): obj is { linkable: (cls: any, cb: (r: any) => any) => void } {
  return typeof (obj as any)?.linkable === "function" && typeof (obj as any)?.Linkable?.wrap === "function";
}

Try / catch

// deprecation warning is not throwable; detect and migrate:
const origWarn = console.warn;
console.warn = (...args) => {
  if (String(args[0]).includes("sst.linkable is deprecated")) {
    migrationNeeded = true;
    return;
  }
  origWarn(...args);
};

Prevention

When it happens

Trigger: Calling the exported `linkable` function directly, e.g. `sst.linkable(MyClass, (m) => ({ properties: {...} }))` in sst.config.ts, or using a library/plugin that still references sst.linkable — the warning fires at bundle/interpret time when the function is invoked.

Common situations: Following older SST documentation, blog posts, or copied snippets that predate the Linkable.wrap API; third-party SST helper libraries not yet updated; incremental migration where some links still use the legacy call.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/561f04bb84b62d56. Report an issue: GitHub.