From d6a5a619c7e056edb1c088d9665cb1d18efe40a3 Mon Sep 17 00:00:00 2001 From: vimtor Date: Fri, 17 Apr 2026 18:22:09 +0200 Subject: [PATCH] reset dev bridge cache before each program run --- platform/src/auto/run.ts | 2 ++ platform/src/components/aws/function.ts | 5 +++++ platform/test/components/function-builder.test.ts | 11 +++++++++++ 3 files changed, 18 insertions(+) diff --git a/platform/src/auto/run.ts b/platform/src/auto/run.ts index 7ecf8d46c1..3f6caf2c12 100644 --- a/platform/src/auto/run.ts +++ b/platform/src/auto/run.ts @@ -7,6 +7,7 @@ import { } from "@pulumi/pulumi"; import { VisibleError } from "../components/error"; +import { Function } from "../components/aws/function"; export async function run(program: automation.PulumiFn) { process.chdir($cli.paths.root); @@ -15,6 +16,7 @@ export async function run(program: automation.PulumiFn) { addTransformationToAddTags(); addTransformationToCheckBucketsHaveMultiplePolicies(); + Function.reset(); Link.reset(); const outputs = (await program()) || {}; outputs._protect = $app.protect; diff --git a/platform/src/components/aws/function.ts b/platform/src/components/aws/function.ts index 1d9d8a39c6..580ec93493 100644 --- a/platform/src/components/aws/function.ts +++ b/platform/src/components/aws/function.ts @@ -1728,6 +1728,11 @@ export class Function extends Component implements Link.Linkable { rpc.call("Provider.Aws.Appsync", {}), ); + /** @internal */ + public static reset() { + Function.devBridgeCode().clear(); + } + constructor( name: string, args: FunctionArgs, diff --git a/platform/test/components/function-builder.test.ts b/platform/test/components/function-builder.test.ts index 7ca69b186a..94c2c5f8cf 100644 --- a/platform/test/components/function-builder.test.ts +++ b/platform/test/components/function-builder.test.ts @@ -68,6 +68,17 @@ describe("Function targets", () => { }); }); +describe("Function reset", () => { + it("clears the dev bridge cache before a new program run", () => { + const cache = (Function as any).devBridgeCode(); + cache.set("us-east-1:bridge", Promise.resolve({})); + + Function.reset(); + + expect(cache.size).toBe(0); + }); +}); + describe("functionBuilder", () => { it("normalizes raw qualified function arns", async () => { const builder = functionBuilder(