Has anyone else ever encountered this error: `* Er...
# aws
d
Has anyone else ever encountered this error:
* Error creating Cloudwatch log subscription filter: ResourceNotFoundException: The specified log group does not exist.
We basically have a CW log subscription filter, which subscribes to a CW log, this is all on a lambda, when we create the lambda+log+subscription for the first time (before any invocation of the lambda) it always fails. It's nothing too fancy, code is here:
Copy code
const logGroup = new aws.cloudwatch.LogGroup(`log-group-${functionName}`, {
        name: `/aws/lambda/${functionName}`,
        retentionInDays: 30,
        tags,
      })
      new aws.cloudwatch.LogSubscriptionFilter(`log-sub-${functionName}`, {
        name: `log-sub-${functionName}`,
        logGroup: logGroup,
        filterPattern: '',
        destinationArn: `arn:aws:lambda:${region}:998119384210:function:datadog-ForwarderStack-C97LY7AXPME-Forwarder-1I6FZ9UCEMET2`,
      })
Once you invoke the function then the filter works, everything is fine
oh damn very silly, writing it here helped me out, I was missing a dependOn
🎉 1
+ another change (msg edited)