CLI throws an error if there is no detections dir
timoguin opened this issue · 1 comments
timoguin commented
Problem
If the Matano CLI doesn't find a detections/ dir, it throws an error:
$ matano diff --user-directory ./config/envs/my-env
› Error: ENOENT: no such file or directory, scandir '/my-homedir/my-repo-path/config/envs/my-env/detections'
exit status 1
Solution
If there is no detections/ dir, the CLI should no-op instead of throwing an error.
timoguin commented
An empty dir leads to a CFN stack failure when attempting to create a bucket notification for the detections bucket.
| Logical ID | Status | Status reason |
|---|---|---|
| DetectionsQueueDPCommonStackMatanoRealtimeBucketNotifications10DA379E819ABF04 | CREATE_FAILED | Invalid parameter: Attributes Reason: FilterPolicy: Empty arrays are not allowed at [Source: (String)"{"resolved_table_name":[]}"; line: 1, column: 26] (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: dd7fdee9-33a0-517c-8515-828d8fad07df; Proxy: null) |
You have to add a placeholder detection like the my_detection one included in the Matano scaffolding tool. This allows the stack creation to succeed.