Closed YogeshBhattGWL closed 2 years ago
I removed your accessKeyId
and secretAccessKey
from your text. It is not a good idea to publish them. It might be a good idea to rotate them now.
Sorry here are a load of questions first?
If you create your service as follows
dynamoDB = DynamoDB(client: AWSClient).with(middlewares:[AWSLoggingMiddleware()])
it will output all the HTTP requests made to AWS which might give you an idea where things are going wrong.
Instead of using static credentials I would use environmental credentials. This will pickup the credentials the lambda is running with and the execution role will define what AWS assets you can access. Although when you run locally you will need to setup the environment variables AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
. If you don't explicitly set the DynamoDB service region it will use the region the lambda is running in but again when running locally you will need to set the environment variable AWS_DEFAULT_REGION
Thanks a lot @adam-fowler. Your answer was really helpful and I found the issue with me and fixed it.
Reason of Issue: Actually my TableName was wrong.
I can't believe this bcz I created table with name: ToDoItems using Amplify but by default Amplify created Table with name ToDoItems-3f4asanedaneku32kaqy-dev. and so I was trying to access ToDoItems.
Note:- As AWS Cli was not setup in my system so I setup and found the error of Requested resource not found
This got me clicked for table name.
Hi @adam-fowler. I am facing problem for running Lambda from AWS Server. Whenever I hit Live URL I am getting error: Internal Server Error
I uploaded same project zip to AWS and checked in cloudWatch and got this error:
2022-05-24T07:08:36.344Z undefined ERROR Uncaught Exception {
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'index'\nRequire stack:\n- /var/runtime/index.mjs",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module 'index'",
"Require stack:",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:726:17)",
" at async Object.module.exports.load (file:///var/runtime/index.mjs:741:21)",
" at async file:///var/runtime/index.mjs:781:15",
" at async file:///var/runtime/index.mjs:4:1"
]
}
I checked my permissions in Lambda and its all good as The error doesn't describe about anything about permission issue. Could you Please suggest me how to track and fix issue.
That looks like a setup issue. It thinks your lambda is node.js.
It's worthwhile reading this blog to make sure you have everything setup correctly https://fabianfett.dev/getting-started-with-swift-aws-lambda-runtime. Especially Step 7 onwards
@adam-fowler Thnx for solution but this was not helpful bcz I wanted to fix something about setup in AWS and i fixed it.
Solution: Make sure you have selected Custom runtime on Amazon Linux 2. instead of Node.js in Runtime Setting.
I am unable to fetch Data from DynamoDB with Lambda Runtime using Local Testing.
To Reproduce Steps to reproduce the behavior:
{"errorType":"FunctionError","errorMessage":"ResourceNotFoundException: Requested resource not found"}
and I Xcode console I am getting error:warning Lambda : lifecycleIteration=0 lambda handler returned an error: ResourceNotFoundException: Requested resource not found
Expected behavior When hitting API I should get data from DynamoDB.
Setup (please complete the following information):
Additional context