Skip to content

Commit a092ab0

Browse files
committed
fix(sqsPlugin): sqs arn defined in cloudformation template is not parsed correctly
1 parent 216d2ea commit a092ab0

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

src/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,7 @@ class ServerlessAwsLambda extends Daemon {
5353
nodeVersion: number | boolean | string | undefined = false;
5454
invokeName?: string;
5555
afterDeployCallbacks: (() => void | Promise<void>)[] = [];
56-
resources: {
57-
ddb: {};
58-
kinesis: {};
59-
sns: {};
60-
sqs: {};
61-
};
56+
resources: ReturnType<typeof getResources> = { ddb: {}, kinesis: {}, sns: {}, sqs: {} };
6257
constructor(serverless: any, options: any, pluginUtils: PluginUtils) {
6358
super({ debug: process.env.SLS_DEBUG == "*" });
6459

@@ -123,8 +118,6 @@ class ServerlessAwsLambda extends Daemon {
123118
"after:aws:deploy:finalize:cleanup": this.afterDeploy.bind(this),
124119
"after:invoke:local:invoke": process.exit,
125120
};
126-
127-
this.resources = getResources(this.serverless);
128121
}
129122

130123
async invokeLocal() {
@@ -143,6 +136,7 @@ class ServerlessAwsLambda extends Daemon {
143136
}
144137
}
145138
async init(isPackaging: boolean) {
139+
this.resources = getResources(this.serverless);
146140
this.#setRuntimeEnvs();
147141
this.#lambdas = this.#getLambdas();
148142
await this.#setCustomEsBuildConfig();

src/lib/parseEvents/sqs.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { log } from "../utils/colorize";
21
export interface ISqs {
32
name: string;
43
arn?: string;
@@ -19,17 +18,17 @@ const parseQueueNameFromObject = (resources: any, Outputs: any, obj: any) => {
1918
if (!values.length) {
2019
return;
2120
}
22-
const topicName = values[1][values[1].length - 1];
21+
const queueName = values[1][values[1].length - 1];
2322

24-
if (typeof topicName == "string") {
25-
return topicName.split("/")[1];
23+
if (typeof queueName == "string") {
24+
return queueName.split("/")[1];
2625
}
2726
} else if (key == "Fn::GetAtt" || key == "Ref") {
2827
const [resourceName] = value as unknown as any[];
2928

3029
const resource = resources?.[resourceName];
3130
if (resource) {
32-
return resource.TopicName;
31+
return resource.QueueName;
3332
}
3433
} else if (key == "Fn::ImportValue" && typeof value == "string") {
3534
return Outputs?.[value]?.Export?.Name;

0 commit comments

Comments
 (0)