Skip to content

Commit 930f72b

Browse files
authored
fix: fixed the env handler is updating during upgrade nodejs (#320)
1 parent d340bb0 commit 930f72b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

newrelic_lambda_cli/layers.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,18 @@ def _add_new_relic(input, config, nr_license_key):
172172

173173
# Update the NEW_RELIC_LAMBDA_HANDLER envvars only when it's a new install.
174174
if runtime_handler and handler != runtime_handler:
175-
update_kwargs["Environment"]["Variables"]["NEW_RELIC_LAMBDA_HANDLER"] = handler
175+
if "nodejs" in runtime:
176+
if handler not in [
177+
"newrelic-lambda-wrapper.handler",
178+
"/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler",
179+
]:
180+
update_kwargs["Environment"]["Variables"][
181+
"NEW_RELIC_LAMBDA_HANDLER"
182+
] = handler
183+
else:
184+
update_kwargs["Environment"]["Variables"][
185+
"NEW_RELIC_LAMBDA_HANDLER"
186+
] = handler
176187

177188
if input.enable_extension and not utils.supports_lambda_extension(runtime):
178189
warning(

0 commit comments

Comments
 (0)