developmentseed / eoapi-cdk

AWS CDK constructs for deploying eoAPI
https://developmentseed.org/eoapi-cdk
11 stars 4 forks source link

CDK keeps waiting for the stack to deploy even when the bootstrapper failed #89

Open emileten opened 9 months ago

emileten commented 9 months ago

The way the database deployment works is :

  1. Create an RDS instance
  2. Create a lambda with the runtime code that creates the pgstac mechanism in that RDS instance
  3. Create a 'custom resource', aka a one-time trigger for that lambda that happens at deployment time.

(3) happens during the deployment. However, if it fails, the CDK doesn't catch the error, but doesn't consider the deployment finished either, and keeps waiting that the stack finishes deploying until we hit the time limit.

vincentsarago commented 9 months ago

I'm interested in this because I've hit that so many time

The simplest solution I found was to test the handler using pytest https://github.com/developmentseed/eoAPI/blob/main/infrastructure/aws/tests/test_bootstrap.py

emileten commented 9 months ago

The simplest solution I found was to test the handler using pytest

👍

Some errors show up only when it runs in the lambda though...

I would be surprised there is no way to quickly link the lambda error to a cloudformation error. This seems related https://github.com/aws/aws-cdk/issues/20933.

vincentsarago commented 9 months ago

Some errors show up only when it runs in the lambda though...

Sure

https://github.com/aws/aws-cdk/issues/20933#issuecomment-1647345584 this comment seems interesting but maybe overkill

vincentsarago commented 9 months ago

here is simple example of the provider code https://github.com/aws-samples/image-optimization/blob/31875ea952dc3810f5ebafc0e505b40f4ee44383/lib/my-custom-resource.ts

emileten commented 6 months ago

Just noting that I saw somewhere recently, we may also be able to just add/change the time out of the custom resource.

Maybe by using Provider in here? Not sure.