Skip to content

sst refresh --stage fails with promise leaks during v3→v4 migration #6724

@mikexavier

Description

@mikexavier

Environment

  • SST: 4.7.1 (from 3.17.10)
  • @pulumi/aws: 7.20.0 (from 6.77.0)
  • @pulumi/pulumi: 3.215.0
  • Bun: 1.3.11, Node: 22, macOS

Issue

sst refresh --stage staging and --stage prod both exit with code 1 due to promise leaks. sst refresh --dev completes cleanly.

sst deploy is blocked by the migration check since refresh didn't complete.

Leaked resource types (via PULUMI_DEBUG_PROMISE_LEAKS=true)

  • aws:lambda/function:Function
  • aws:lambda/functionUrl:FunctionUrl
  • aws:lambda/functionEventInvokeConfig:FunctionEventInvokeConfig
  • aws:lambda/permission:Permission
  • aws:s3/bucketPolicy:BucketPolicy
  • aws:iam/rolePolicy:RolePolicy
  • pulumi-nodejs:dynamic:Resource (KvKeys)

Stack traces originate from function.ts:2668 inside apply(async ...) at function.ts:1888.

Stack composition

Astro (×2), Nextjs (×1), StaticSite (×1), Function (×12), Cron (×9), Queue (×12), SnsTopic (×3), ApiGatewayWebSocket (×1), Router (×4), Postgres (×2), Dynamo (×10), Email (×1), Vpc (×1).

Possibly related

Additional context

  • This stack deployed without issues on SST 3.17.10
  • sst diff --stage staging evaluates all resources and shows correct changes before the promise leak exits the process
  • Tested disabling the $transform below — same result
$transform(sst.aws.Function, (args) => {
  args.runtime ??= 'nodejs22.x';
  args.nodejs = { ...args.nodejs, sourcemap: true };
  args.environment = $output(args.environment).apply((env) => {
    // adds --enable-source-maps to NODE_OPTIONS
  });
});

Current state

  • Dev: sst refresh --dev completed. sst deploy failed — attempted to create new RDS instances instead of updating existing ones.
  • Staging: sst refresh --stage staging failed (promise leaks). Attempted sst deploy which partially completed — deleted v3 resources but did not create v4 replacements. Staging sites are down (empty KvStore, missing server functions).
  • Prod: sst refresh --stage prod failed (promise leaks). Deploy not attempted. Prod is running on v3-deployed resources but state is now v7 format. Cannot deploy with v3 or v4.

I'd appreciate some guidance on how to safely deploy to prod given the v7 state and the promise leak blocking the migration.

Separate: Bun catalog: protocol

nodejs.install copies literal "catalog:" into Lambda build package.json. npm install fails. Workaround: explicit versions for affected packages.

Metadata

Metadata

Assignees

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