Hello,
I'm using NodeJS 14.x lambda to control an ecs service. As I do not need the ecs task to run permanently, I created a service inside the cluster so I can play around the desired count to start or stop it at will. I also created two lambdas, one for querying the current desired count and the current Public IP, another one for updating said desired count (to 0 or 1 should I want to start or stop it)
I have packed aws-sdk v3 on a lambda layer to not have to package it on each lambda. Seems to work fine as I was getting runtime error
"Runtime.ImportModuleError: Error: Cannot find module '@aws-sdk/client-ecs'"
But I do not anymore.
The code is also working fine from my workstation as I'm able to execute it locally and I get the desired result (query to ecs api works fine)
But All I get when testing from lambdas are Timeouts... It usually execute in less than 3 secondes on my local workstation but even with a lambda timeout set up at 3 minutes, this is what I get
START RequestId: XXXX-XX-XXXX Version: $LATEST
2022-01-11T23:57:59.528Z XXXX-XX-XXXX INFO before ecs client send
END RequestId: XXXX-XX-XXXX
REPORT RequestId: XXXX-XX-XXXX Duration: 195100.70 ms Billed Duration: 195000 ms Memory Size: 128 MB Max Memory Used: 126 MB Init Duration: 1051.68 ms
2022-01-12T00:01:14.533Z XXXX-XX-XXXX Task timed out after 195.10 seconds
The message before ecs client send
is a console.log I made just before the ecs.send request for debug purposes
I think I've set up the policy correctly, as well as the Lambda VPC with the default outbound rule to allow all protocol on all port to 0.0.0.0/0 so I I have no idea on where to look now.
I have not found any way to debug aws-sdk V3 calls like you would do on V2 by adding a logger to the config. Maybe it could help understanding the issue....