Skip to content

Platform source has TypeScript errors in unused-feature files (static-site.ts, vpc.ts) — blocks strict tsc users #6885

@DivMode

Description

@DivMode

Summary

SST 4.14.3 platform source has two TypeScript errors that surface for any user typechecking infra code with strict tsc --noEmit. The bugs are in features the user doesn't necessarily use (sst.cloudflare.StaticSite, sst.aws.Vpc) but tsc compiles them transitively via namespace re-exports, so users hit them regardless.

This is related to but distinct from #5890 — that issue is about the broader architecture (platform .ts source vs .d.ts); this issue is about two specific, fixable bugs.

Repro

# Any SST 4.14.3 project with @pulumi/cloudflare 6.16+ and @pulumi/aws 7.x
npx tsc --noEmit --project tsconfig.infra.json

Errors

.sst/platform/src/components/cloudflare/static-site.ts(404,22): error TS2488:
  Type 'UnwrappedArray<Input<WorkersScriptBinding>> | undefined' must have a
  '[Symbol.iterator]()' method that returns an iterator.

.sst/platform/src/components/aws/vpc.ts(985,19): error TS2353:
  Object literal may only specify known properties, and 'vpc' does not exist in type 'EipArgs'.

.sst/platform/src/components/aws/vpc-v1.ts(247,17): error TS2353:
  Object literal may only specify known properties, and 'vpc' does not exist in type 'EipArgs'.

Root cause

static-site.ts line ~404:

workerArgs.bindings = output(workerArgs.bindings ?? []).apply(
  (bindings) => [
    ...bindings,                       // ← `bindings` is `T[] | undefined` here
    { type: "kv_namespace", ... },
  ],
);

bindings after the output().apply() is UnwrappedArray<Input<WorkersScriptBinding>> | undefined. The spread ...bindings fails the iterability check when it's undefined. Fix: ...(bindings ?? []).

aws/vpc.ts line ~985 and aws/vpc-v1.ts line ~247:

new ec2.Eip(..., { vpc: true }, ...);

@pulumi/aws v7 deprecated vpc in favor of domain: "vpc". Looking at the dev branch this is already fixed there, just hasn't been released past 4.14.3 yet.

Suggested fix

  1. static-site.ts: replace ...bindings, with ...(bindings ?? []), (1 line)
  2. aws/vpc.ts + aws/vpc-v1.ts: replace vpc: true, with domain: "vpc", (already done on dev branch)
  3. Cut a 4.14.4 release with both fixes

Workaround in the meantime

We use a sed-based patch script in our build pipeline. Idempotent, grep-gated. Documented as a temporary workaround pointing back to this issue.

# cloudflare/static-site.ts
sed -i '' 's|^                  \.\.\.bindings,$|                  ...(bindings ?? []),|' \
  .sst/platform/src/components/cloudflare/static-site.ts

# aws/vpc.ts + aws/vpc-v1.ts
sed -i '' 's|vpc: true,|domain: "vpc",|' .sst/platform/src/components/aws/vpc.ts
sed -i '' 's|vpc: true,|domain: "vpc",|' .sst/platform/src/components/aws/vpc-v1.ts

Why this matters

These errors don't affect sst dev / sst deploy (those use esbuild, which is lenient on types). They only bite users who run strict tsc against their infra code for fast-feedback typechecking — a common pattern. Without a fix, every such user either patches platform source post-install or gives up strict typechecking.

Once #5890's larger fix lands (ship .d.ts or move SST to node_modules), this becomes moot. Until then, three one-line source fixes would unblock the strict-tsc cohort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions