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

newrelic-lambda integrations update fails to update pre-0.9 stack due to No newrelic-log-ingestion function in region ... error JIRA #278

Closed chaudharysaket closed 5 months ago

chaudharysaket commented 5 months ago

Description

Testing if JIRA integration is working https://github.com/newrelic/newrelic-lambda-cli/issues/267

Steps to Reproduce

Create a stack with the "old" function name, i.e. using a CLI version 0.8.0 or earlier Attempt to update it with newrelic-lambda integrations update ... using CLI version 0.9.0

Expected Behaviour

The update should succeed, either renaming the function or preserving it with the old name.

It looks like https://github.com/newrelic/newrelic-lambda-cli/pull/254 may have introduced some if statements that aren't working as intended given its stated goal of preserving compatibility.

newrelic-lambda-cli/newrelic_lambda_cli/integrations.py

Lines 89 to 103 in f472e28

def get_unique_newrelic_log_ingestion_name(session, stackname=None): if not stackname: stackname = INGEST_STACK_NAME stack_id = _get_cf_stack_id(session, stack_name=stackname) if stack_id: return "newrelic-log-ingestion-%s" % (stack_id.split("/")[2].split("-")[4])

def get_newrelic_log_ingestion_function(session, stackname=None): unique_log_ingestion_name = get_unique_newrelic_log_ingestion_name( session, stackname ) if unique_log_ingestion_name: function = get_function(session, unique_log_ingestion_name) return function In addition, it would be nice if the logs were more specific about which function doesn't exist. I would've identified the problem with far less effort if the error printed out No newrelic-log-ingestion-0aa... function in region, given we do have function called newrelic-log-ingestion as literally appears in the error message.

Relevant Logs / Console output

Your Environment

Additional context