newrelic / newrelic-lambda-cli

A CLI to install the New Relic AWS Lambda integration and layers.
https://newrelic.com/products/serverless-aws-lambda
Apache License 2.0
47 stars 53 forks source link

NewRelicLogIngestion stack adds random id to NewRelicLogIngestionFunction name, thus failing subsequent checks #240

Closed Brendmanitix closed 8 months ago

Brendmanitix commented 1 year ago

Description

Running newrelic-lambda integrations install -e ... completes successfully, but the NewRelicLogIngestionFunction in the NewRelicLogIngestion stack has an id suffix newrelic-log-ingestion-0a20eba5a086 which causes subsequent commands to fail. When I first ran install, I got this error message telling me to remove the existing lambda and re-installing. https://github.com/newrelic/newrelic-lambda-cli/blob/3e56f005af4ccb4328b282886894e5f42a8c8328/newrelic_lambda_cli/integrations.py#L565.

 newrelic-lambda integrations update ...
✖️  No 'newrelic-log-ingestion' function in region 'ap-southeast-2'. Run 'newrelic-lambda integrations install' to install it.
✖️ Install Incomplete. See messages above for details.

or

 newrelic-lambda subscriptions install --function installed  --filter-pattern ""
✖️ Could not find 'newrelic-log-ingestion' function. Is the New Relic AWS integration installed?
✖️ Install Incomplete. See messages above for details.

Steps to Reproduce

  1. Delete old newrelic-log-ingestion function that was not part of a CloudFormation stack
  2. run newrelic-lambda integrations install -e [...]
  3. run newrelic-lambda integrations update [...]
  4. see error No 'newrelic-log-ingestion' function in region 'ap-southeast-2
  5. run newrelic-lambda integrations uninstall
  6. run steps 2 and 3, and see the same error as step 4.

Expected Behaviour

Commands should find installed log ingestion function and perform updates, etc.

Relevant Logs / Console output

Other stack resources, in case that's useful. They all appear to have a suffix.

LambdaInvokePermission  NewRelicLogIngestion-LambdaInvokePermission-HASMX8VAHO53    AWS::Lambda::Permission
NewRelicLogIngestionFunction    newrelic-log-ingestion-020b137477d6     AWS::Lambda::Function
NewRelicLogIngestionFunctionRole    NewRelicLogIngestion-NewRelicLogIngestionFunctionR-1RHLBPAKE4ZHY    AWS::IAM::Role
Brendmanitix commented 1 year ago

On closer inspection, it looks like the suffix is the AWS::StackId

It appears to be a deliberate change to the aws-log-ingestion template:

https://github.com/newrelic/aws-log-ingestion/commit/de0271fc55a9abf13a34c09e8b24d23e0127c05a

🤷‍♂️

hmstepanek commented 1 year ago

I've filled an internal bug report on this to get this onto our roadmap and fix it.