By using AWS re:Post, you agree to the Terms of Use

Questions tagged with AWS Serverless Application Repository

Sort by most recent
  • 1
  • 2
  • 12 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

My local MongoDB is refusing to connect with AWS SAM Lambda in python

I have set up an AWS Lambda function using the AWS SAM app. I have also downloaded local MongoDB on my machine. I am trying to make a connection between AWS Lambda and MongoDB. You can see my code below: ``` import json import pymongo client = pymongo.MongoClient('mongodb://localhost:27017/') mydb = client['Employee'] def lambda_handler(event, context): information = mydb.employeeInformation record = { 'FirstName' : 'Rehan', 'LastName' : 'CH', 'Department' : "IT" } information.insert_one(record) print("Record added") return { "statusCode": 200, "body": json.dumps( { "message": "hello world", # "location": ip.text.replace("\n", "") } ), } ``` When I run the sam app using command ``` sam local invoke ``` it throws an error that you can see below: ``` [ERROR] ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 62b16aa14a95a3e56eb0e7cb, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localho raise ServerSelectionTimeoutError(, line 227, in _select_servers_looprtn_support ``` I also have searched for this error and eventually, I found some but didn't get help from them. That's why I have to post it again. Its my first time interaction with MongoDB. Can someone tell me how do I resolve this error, or where I am doing wrong?
2
answers
0
votes
48
views
asked 3 months ago

JumpCloud Serverlesss Lambda Function timeout error

Hello Giks, Hope all doing good. I'm facing issue while running a serverless application Lambda function. I used this application to download files from remote node and store it to S3 bucket. it was working fine previously, all of sudden it stop fetching files source location. while debugging issue I observe that it was a lot of time complete a test event. In the CloudWatch logs I'm getting below error logs. ***START RequestId: 052226a9-5344-45f1-88bf-5c00242baee0 Version: $LATEST END RequestId: 052226a9-5344-45f1-88bf-5c00242baee0 REPORT RequestId: 052226a9-5344-45f1-88bf-5c00242baee0 Duration: 180625.18 ms Billed Duration: 180000 ms Memory Size: 192 MB Max Memory Used: 193 MB Init Duration: 587.37 ms XRAY TraceId: 1-626104fb-16ae94a33273f6404d180e41 SegmentId: 1010be2c3227cfab Sampled: true REPORT RequestId: 052226a9-5344-45f1-88bf-5c00242baee0 Duration: 180625.18 ms Billed Duration: 180000 ms Memory Size: 192 MB Max Memory Used: 193 MB Init Duration: 587.37 ms XRAY TraceId: 1-626104fb-16ae94a33273f6404d180e41 SegmentId: 1010be2c3227cfab Sampled: true 2022-04-21T07:20:17.417Z 052226a9-5344-45f1-88bf-5c00242baee0 Task timed out after 180.63 seconds*** I have tried increasing memory and timeout parameter but still getting same error. In X-Ray Trace Logs getting below response. serverlessrepo-JumpCloud--DirectoryInsightsFunctio-fgqp218AtLpYAWS::Lambda serverlessrepo-JumpCloud--DirectoryInsightsFunctio-fgqp218AtLpY OK 202 17ms Dwell Time OK - 47ms Attempt #1 Error (4xx) 200 3.03min Attempt #2 Error (4xx) 200 3.00min Attempt #3 Error (4xx) 200 3.00min serverlessrepo-JumpCloud--DirectoryInsightsFunctio-fgqp218AtLpYAWS::Lambda::Function serverlessrepo-JumpCloud--DirectoryInsightsFunctio-fgqp218AtLpY Error (4xx) - 3.01min Initialization OK - 587ms Invocation Error (4xx) - 3.01min serverlessrepo-JumpCloud--DirectoryInsightsFunctio-fgqp218AtLpY Error (4xx) - 3.00min Initialization OK - 611ms Invocation Error (4xx) - 3.00min serverlessrepo-JumpCloud--DirectoryInsightsFunctio-fgqp218AtLpY Error (4xx) - 3.00min Initialization OK - 549ms Invocation Error (4xx) - 3.00min Can anyone advise if anything I missed to debug. Thanks, Aman
2
answers
0
votes
31
views
asked 5 months ago

Serverless application repository return a 500 error when including an openapi specification with Fn::Transform in DefinitonBody of serverless::api

Hi, I'm currently creating a pipeline with CodePipeline which builds SAM templates for different services, and in some of these services we use a reference to an openapi specification through Fn::Transform and AWS::Include referencing a specification which is uploaded to an S3 bucket. This does not seem to be working when publishing a new version of the transformed SAM template to the Serverless Application Repository. I've investigated why this is and it does not seem to be the definition of the API itself (tried the most basic openapi specification possible with a single endpoint and no references) but specifically the: ``` DefinitionBody: "Fn::Transform": Name: "AWS::Include" Parameters: Location: <S3 link> ``` part that is failing. As soon as I remove that part the new version can be published. This definition works just fine when deploying through "**sam deploy**". When we have done the "**sam build**" command we try to publish a new version of the transformed specification and get a 500 internal server error back. When looking into the aws cloudtrail we do not get any more specific information either. We cannot use DefinitionUri either to handle it due to the references between the SAM template and the openapi specification. I've tried to find information on how to do Is there some alternative way to handle this issue which is supported by the Serverless Application Repository? Or is this an issue with serverless application repository itself? Edit: Just to clarify, I have added permission to read the bucket for the serverless application repository (and verified it works)
0
answers
0
votes
39
views
asked 7 months ago
  • 1
  • 2
  • 12 / page