Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions platform/src/auto/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions platform/src/components/aws/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions platform/test/components/function-builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading