Skip to content

Commit e19a0da

Browse files
committed
simplify delete response
1 parent 73e9f66 commit e19a0da

File tree

1 file changed

+16
-16
lines changed
  • ab-testing/dictionary-deploy-lambda/src

1 file changed

+16
-16
lines changed

ab-testing/dictionary-deploy-lambda/src/index.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ export const handler: Handler = async (
3535
event: CloudFormationCustomResourceEvent,
3636
context: Context,
3737
): Promise<void> => {
38+
if (event.RequestType === "Delete") {
39+
// No action needed on delete
40+
await send(event, context, "SUCCESS");
41+
return;
42+
}
3843
try {
3944
const apiToken = await getSecureString(
4045
`/ab-testing/${process.env.STAGE}/fastly-api-token`,
@@ -61,23 +66,18 @@ export const handler: Handler = async (
6166
);
6267
const mvtDictionary = await service.getDictionary(mvtDictionaryName);
6368

64-
if (event.RequestType === "Create" || event.RequestType === "Update") {
65-
await fetchAndDeployArtifacts([
66-
{
67-
artifact: "ab-test-groups.json",
68-
dictionary: abTestsDictionary,
69-
},
70-
{
71-
artifact: "mvt-groups.json",
72-
dictionary: mvtDictionary,
73-
},
74-
]);
69+
await fetchAndDeployArtifacts([
70+
{
71+
artifact: "ab-test-groups.json",
72+
dictionary: abTestsDictionary,
73+
},
74+
{
75+
artifact: "mvt-groups.json",
76+
dictionary: mvtDictionary,
77+
},
78+
]);
7579

76-
await send(event, context, "SUCCESS");
77-
} else {
78-
// For Delete requests, simply respond with SUCCESS
79-
await send(event, context, "SUCCESS");
80-
}
80+
await send(event, context, "SUCCESS");
8181
} catch (error) {
8282
console.error("Error deploying dictionaries:", error);
8383
await send(event, context, "FAILED", {

0 commit comments

Comments
 (0)