I am working on AWS Solutions Architecting Module 13 Challenge Lab. I have written the following code in my AWS Lambda SalesAnalysisReport function's salesAnalysisReport.py
file :
response = snsClient.publish(
TopicArn = arn:aws:sns:us-east-1:507782174659:SalesReportTopic,
Subject = 'Daily Sales Analysis Report',
Message = message.getvalue()
)
I am running default hello-world
test case and getting the following error message :
[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'salesAnalysisReport': invalid syntax (salesAnalysisReport.py, line 129)
Traceback (most recent call last):
File "/var/task/salesAnalysisReport.py" Line 129
TopicArn = arn:aws:sns:us-east-1:507782174659:SalesReportTopic,END RequestId: 5bb30f77-0fae-453a-8f56-b89cdbd064a8
I am using Python 3.8
as directed in lab instructions.
I would like to know the cause of error so that I can resolve it
P.S. - Line 129(error causing line) is
TopicArn = arn:aws:sns:us-east-1:507782174659:SalesReportTopic,
I tried putting the value of TopicArn
in double quotes and then using that for TopicArn
but that didn't work.
CodePudding user response:
You need to enclose it in single quotes, so it is a string
as required by Boto3.
Try:
response = snsClient.publish(
TopicArn = 'arn:aws:sns:us-east-1:507782174659:SalesReportTopic',
Subject = 'Daily Sales Analysis Report',
Message = message.getvalue()
)