-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Description
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 #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
The update fails, with error:
✖️ No newrelic-log-ingestion function in region 'ap-southeast-2'. Run 'newrelic-lambda integrations install' to install it.
✖️ Update Incomplete. See messages above for details.
I inserted debug logs like the following:
modified newrelic_lambda_cli/integrations.py
@@ -98,6 +98,7 @@ def get_newrelic_log_ingestion_function(session, stackname=None):
unique_log_ingestion_name = get_unique_newrelic_log_ingestion_name(
session, stackname
)
+ print(f"DEBUG: {unique_log_ingestion_name=}")
if unique_log_ingestion_name:
function = get_function(session, unique_log_ingestion_name)
return functionIt prints DEBUG: unique_log_ingestion_name='newrelic-log-ingestion-0aa...'. That is, the function name has a unique suffix. Our AWS account indeed doesn't have a lambda with this name; although does have newrelic-log-ingestion.
Your Environment
macOS
# requirements.txt
newrelic-lambda-cli==0.9.0
boto3==1.34.59
botocore==1.34.59
jmespath==1.0.1
python-dateutil==2.9.0.post0
six==1.16.0
urllib3==2.0.7
s3transfer==0.10.0
click==8.1.7
colorama==0.4.6
emoji==2.10.1
gql==2.0.0
graphql-core==2.3.2
promise==2.3
Rx==1.6.3
requests==2.31.0
charset-normalizer==3.3.2
idna==3.6
certifi==2024.2.2
tabulate==0.9.0
Additional context
N/A