newrelic-lambda-cli 0.9.5__tar.gz → 0.9.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/PKG-INFO +18 -7
  2. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/README.md +7 -5
  3. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/cli/layers.py +5 -0
  4. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/layers.py +19 -1
  5. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/types.py +1 -0
  6. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/utils.py +4 -0
  7. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli.egg-info/PKG-INFO +18 -7
  8. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/setup.py +1 -1
  9. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/tests/test_layers.py +113 -0
  10. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/CODE_OF_CONDUCT.md +0 -0
  11. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/CONTRIBUTING.md +0 -0
  12. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/LICENSE +0 -0
  13. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/MANIFEST.in +0 -0
  14. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/THIRD_PARTY_NOTICES.md +0 -0
  15. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/__init__.py +0 -0
  16. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/api.py +0 -0
  17. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/cli/__init__.py +0 -0
  18. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/cli/decorators.py +0 -0
  19. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/cli/functions.py +0 -0
  20. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/cli/integrations.py +0 -0
  21. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/cli/otel_ingestions.py +0 -0
  22. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/cli/subscriptions.py +0 -0
  23. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/cliutils.py +0 -0
  24. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/functions.py +0 -0
  25. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/integrations.py +0 -0
  26. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/otel_ingestions.py +0 -0
  27. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/permissions.py +0 -0
  28. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/subscriptions.py +0 -0
  29. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/templates/import-template.yaml +0 -0
  30. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/templates/license-key-secret.yaml +0 -0
  31. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli/templates/nr-lambda-integration-role.yaml +0 -0
  32. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli.egg-info/SOURCES.txt +0 -0
  33. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli.egg-info/dependency_links.txt +0 -0
  34. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli.egg-info/entry_points.txt +0 -0
  35. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli.egg-info/not-zip-safe +0 -0
  36. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli.egg-info/requires.txt +0 -0
  37. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/newrelic_lambda_cli.egg-info/top_level.txt +0 -0
  38. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/pyproject.toml +0 -0
  39. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/setup.cfg +0 -0
  40. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/tests/test_api.py +0 -0
  41. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/tests/test_functions.py +0 -0
  42. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/tests/test_integrations.py +0 -0
  43. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/tests/test_new_relic_gql.py +0 -0
  44. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/tests/test_permissions.py +0 -0
  45. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/tests/test_subscriptions.py +0 -0
  46. {newrelic_lambda_cli-0.9.5 → newrelic_lambda_cli-0.9.7}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: newrelic-lambda-cli
3
- Version: 0.9.5
3
+ Version: 0.9.7
4
4
  Summary: A CLI to install the New Relic AWS Lambda integration and layers.
5
5
  Home-page: https://github.com/newrelic/newrelic-lambda-cli
6
6
  Author: New Relic
@@ -14,6 +14,15 @@ Requires-Dist: colorama
14
14
  Requires-Dist: gql<3,>=2
15
15
  Requires-Dist: requests<3
16
16
  Requires-Dist: tabulate
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license-file
23
+ Dynamic: requires-dist
24
+ Dynamic: requires-python
25
+ Dynamic: summary
17
26
 
18
27
  [![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)
19
28
 
@@ -76,6 +85,7 @@ A CLI to install the New Relic AWS Lambda integration and layers.
76
85
  * python3.13
77
86
  * ruby3.2
78
87
  * ruby3.3
88
+ * ruby3.4
79
89
 
80
90
  **Note:** Automatic handler wrapping is only supported for Node.js, Python, Java, and Ruby. For other runtimes,
81
91
  manual function wrapping is required using the runtime specific New Relic agent.
@@ -172,8 +182,8 @@ newrelic-lambda integrations update \
172
182
 
173
183
  | Option | Required? | Description |
174
184
  |--------|-----------|-------------|
175
- | `--nr-account-id` or `-a` | Yes | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for the integration. Only required if changing the account to which the logs are sent. Can also use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
176
- | `--nr-api-key` or `-k` | Yes | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. Only required if changing the account to which the logs are sent. |
185
+ | `--nr-account-id` or `-a` | Yes | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for the integration. Alternatively, you can use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
186
+ | `--nr-api-key` or `-k` | Yes | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Alternatively, you can use the `NEW_RELIC_API_KEY` environment variable. |
177
187
  | `--disable-logs` or `-d` | No | Disables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ...` afterwards. |
178
188
  | `--enable-logs` or `-e` | No | Enables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ... --filter-pattern ""` afterwards. |
179
189
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. |
@@ -210,6 +220,7 @@ newrelic-lambda layers install \
210
220
  | `--nr-api-key` or `-k` | No | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
211
221
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
212
222
  | `--java_handler_method` or `-j` | No | For java runtimes only to specify an aws implementation method. Defaults to RequestHandler. Optional inputs are: handleRequest, handleStreamsRequest `--java_handler_method handleStreamsRequest`. |
223
+ | `--esm` | No | For Node.js functions using ES Modules (ESM), enable the specific ESM wrapper during installation (e.g., using the --esm flag). This sets the Lambda handler to `/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler`. |
213
224
 
214
225
  #### Uninstall Layer
215
226
 
@@ -345,11 +356,11 @@ newrelic-lambda subscriptions uninstall --function <name or arn> --otel
345
356
 
346
357
  ## Docker
347
358
 
348
- Now, you can run newrelic-lambda-cli as a container.
359
+ Now, you can run newrelic-lambda-cli as a [container](https://gallery.ecr.aws/newrelic-lambda-layers-for-docker/newrelic-lambda-cli).
349
360
 
350
361
  ```bash
351
- docker build -t newrelic-lambda-cli .
352
- docker run -e AWS_PROFILE=your_profile -v $HOME/.aws:/home/newrelic-lambda-cli/.aws newrelic-lambda-cli functions list
362
+ docker pull public.ecr.aws/newrelic-lambda-layers-for-docker/newrelic-lambda-cli:0.9.4
363
+ docker run -v $HOME/.aws:/home/newrelic-lambda-cli/.aws "newrelic-lambda-cli" functions list
353
364
  ```
354
365
 
355
366
  ## Contributing
@@ -59,6 +59,7 @@ A CLI to install the New Relic AWS Lambda integration and layers.
59
59
  * python3.13
60
60
  * ruby3.2
61
61
  * ruby3.3
62
+ * ruby3.4
62
63
 
63
64
  **Note:** Automatic handler wrapping is only supported for Node.js, Python, Java, and Ruby. For other runtimes,
64
65
  manual function wrapping is required using the runtime specific New Relic agent.
@@ -155,8 +156,8 @@ newrelic-lambda integrations update \
155
156
 
156
157
  | Option | Required? | Description |
157
158
  |--------|-----------|-------------|
158
- | `--nr-account-id` or `-a` | Yes | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for the integration. Only required if changing the account to which the logs are sent. Can also use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
159
- | `--nr-api-key` or `-k` | Yes | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. Only required if changing the account to which the logs are sent. |
159
+ | `--nr-account-id` or `-a` | Yes | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for the integration. Alternatively, you can use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
160
+ | `--nr-api-key` or `-k` | Yes | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Alternatively, you can use the `NEW_RELIC_API_KEY` environment variable. |
160
161
  | `--disable-logs` or `-d` | No | Disables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ...` afterwards. |
161
162
  | `--enable-logs` or `-e` | No | Enables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ... --filter-pattern ""` afterwards. |
162
163
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. |
@@ -193,6 +194,7 @@ newrelic-lambda layers install \
193
194
  | `--nr-api-key` or `-k` | No | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
194
195
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
195
196
  | `--java_handler_method` or `-j` | No | For java runtimes only to specify an aws implementation method. Defaults to RequestHandler. Optional inputs are: handleRequest, handleStreamsRequest `--java_handler_method handleStreamsRequest`. |
197
+ | `--esm` | No | For Node.js functions using ES Modules (ESM), enable the specific ESM wrapper during installation (e.g., using the --esm flag). This sets the Lambda handler to `/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler`. |
196
198
 
197
199
  #### Uninstall Layer
198
200
 
@@ -328,11 +330,11 @@ newrelic-lambda subscriptions uninstall --function <name or arn> --otel
328
330
 
329
331
  ## Docker
330
332
 
331
- Now, you can run newrelic-lambda-cli as a container.
333
+ Now, you can run newrelic-lambda-cli as a [container](https://gallery.ecr.aws/newrelic-lambda-layers-for-docker/newrelic-lambda-cli).
332
334
 
333
335
  ```bash
334
- docker build -t newrelic-lambda-cli .
335
- docker run -e AWS_PROFILE=your_profile -v $HOME/.aws:/home/newrelic-lambda-cli/.aws newrelic-lambda-cli functions list
336
+ docker pull public.ecr.aws/newrelic-lambda-layers-for-docker/newrelic-lambda-cli:0.9.4
337
+ docker run -v $HOME/.aws:/home/newrelic-lambda-cli/.aws "newrelic-lambda-cli" functions list
336
338
  ```
337
339
 
338
340
  ## Contributing
@@ -103,6 +103,11 @@ def register(group):
103
103
  show_default=True,
104
104
  type=click.Choice(["handleRequest", "handleStreamsRequest"]),
105
105
  )
106
+ @click.option(
107
+ "--esm",
108
+ is_flag=True,
109
+ help="Nodejs runtimes only - nodejs implementation runtime handler to /opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler",
110
+ )
106
111
  @click.pass_context
107
112
  def install(ctx, **kwargs):
108
113
  """Install New Relic AWS Lambda Layers"""
@@ -100,6 +100,13 @@ def _add_new_relic(input, config, nr_license_key):
100
100
  if "java" in runtime:
101
101
  postfix = input.java_handler_method or "handleRequest"
102
102
  runtime_handler = runtime_handler + postfix
103
+ if "nodejs" in runtime:
104
+ prefix = (
105
+ "/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index"
106
+ if input.esm
107
+ else "newrelic-lambda-wrapper"
108
+ )
109
+ runtime_handler = prefix + ".handler"
103
110
 
104
111
  existing_newrelic_layer = [
105
112
  layer["Arn"]
@@ -165,7 +172,18 @@ def _add_new_relic(input, config, nr_license_key):
165
172
 
166
173
  # Update the NEW_RELIC_LAMBDA_HANDLER envvars only when it's a new install.
167
174
  if runtime_handler and handler != runtime_handler:
168
- 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
169
187
 
170
188
  if input.enable_extension and not utils.supports_lambda_extension(runtime):
171
189
  warning(
@@ -107,6 +107,7 @@ LAYER_INSTALL_KEYS = [
107
107
  "enable_extension",
108
108
  "enable_extension_function_logs",
109
109
  "java_handler_method",
110
+ "esm",
110
111
  ]
111
112
 
112
113
  LAYER_UNINSTALL_KEYS = [
@@ -83,6 +83,10 @@ RUNTIME_CONFIG = {
83
83
  "Handler": "newrelic_lambda_wrapper.handler",
84
84
  "LambdaExtension": True,
85
85
  },
86
+ "ruby3.4": {
87
+ "Handler": "newrelic_lambda_wrapper.handler",
88
+ "LambdaExtension": True,
89
+ },
86
90
  }
87
91
 
88
92
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: newrelic-lambda-cli
3
- Version: 0.9.5
3
+ Version: 0.9.7
4
4
  Summary: A CLI to install the New Relic AWS Lambda integration and layers.
5
5
  Home-page: https://github.com/newrelic/newrelic-lambda-cli
6
6
  Author: New Relic
@@ -14,6 +14,15 @@ Requires-Dist: colorama
14
14
  Requires-Dist: gql<3,>=2
15
15
  Requires-Dist: requests<3
16
16
  Requires-Dist: tabulate
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license-file
23
+ Dynamic: requires-dist
24
+ Dynamic: requires-python
25
+ Dynamic: summary
17
26
 
18
27
  [![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)
19
28
 
@@ -76,6 +85,7 @@ A CLI to install the New Relic AWS Lambda integration and layers.
76
85
  * python3.13
77
86
  * ruby3.2
78
87
  * ruby3.3
88
+ * ruby3.4
79
89
 
80
90
  **Note:** Automatic handler wrapping is only supported for Node.js, Python, Java, and Ruby. For other runtimes,
81
91
  manual function wrapping is required using the runtime specific New Relic agent.
@@ -172,8 +182,8 @@ newrelic-lambda integrations update \
172
182
 
173
183
  | Option | Required? | Description |
174
184
  |--------|-----------|-------------|
175
- | `--nr-account-id` or `-a` | Yes | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for the integration. Only required if changing the account to which the logs are sent. Can also use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
176
- | `--nr-api-key` or `-k` | Yes | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. Only required if changing the account to which the logs are sent. |
185
+ | `--nr-account-id` or `-a` | Yes | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for the integration. Alternatively, you can use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
186
+ | `--nr-api-key` or `-k` | Yes | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Alternatively, you can use the `NEW_RELIC_API_KEY` environment variable. |
177
187
  | `--disable-logs` or `-d` | No | Disables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ...` afterwards. |
178
188
  | `--enable-logs` or `-e` | No | Enables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ... --filter-pattern ""` afterwards. |
179
189
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. |
@@ -210,6 +220,7 @@ newrelic-lambda layers install \
210
220
  | `--nr-api-key` or `-k` | No | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
211
221
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
212
222
  | `--java_handler_method` or `-j` | No | For java runtimes only to specify an aws implementation method. Defaults to RequestHandler. Optional inputs are: handleRequest, handleStreamsRequest `--java_handler_method handleStreamsRequest`. |
223
+ | `--esm` | No | For Node.js functions using ES Modules (ESM), enable the specific ESM wrapper during installation (e.g., using the --esm flag). This sets the Lambda handler to `/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler`. |
213
224
 
214
225
  #### Uninstall Layer
215
226
 
@@ -345,11 +356,11 @@ newrelic-lambda subscriptions uninstall --function <name or arn> --otel
345
356
 
346
357
  ## Docker
347
358
 
348
- Now, you can run newrelic-lambda-cli as a container.
359
+ Now, you can run newrelic-lambda-cli as a [container](https://gallery.ecr.aws/newrelic-lambda-layers-for-docker/newrelic-lambda-cli).
349
360
 
350
361
  ```bash
351
- docker build -t newrelic-lambda-cli .
352
- docker run -e AWS_PROFILE=your_profile -v $HOME/.aws:/home/newrelic-lambda-cli/.aws newrelic-lambda-cli functions list
362
+ docker pull public.ecr.aws/newrelic-lambda-layers-for-docker/newrelic-lambda-cli:0.9.4
363
+ docker run -v $HOME/.aws:/home/newrelic-lambda-cli/.aws "newrelic-lambda-cli" functions list
353
364
  ```
354
365
 
355
366
  ## Contributing
@@ -6,7 +6,7 @@ README = open(os.path.join(os.path.dirname(__file__), "README.md"), "r").read()
6
6
 
7
7
  setup(
8
8
  name="newrelic-lambda-cli",
9
- version="0.9.5",
9
+ version="0.9.7",
10
10
  python_requires=">=3.3",
11
11
  description="A CLI to install the New Relic AWS Lambda integration and layers.",
12
12
  long_description=README,
@@ -298,6 +298,119 @@ def test_add_new_relic_dotnet(aws_credentials, mock_function_config):
298
298
  )
299
299
 
300
300
 
301
+ @mock_aws
302
+ def test_add_new_relic_nodejs(aws_credentials, mock_function_config):
303
+ """
304
+ Tests adding New Relic layer and configuration to Node.js functions,
305
+ including the standard and ESM wrapper handlers.
306
+ """
307
+ session = boto3.Session(region_name="us-east-1")
308
+ nr_license_key = "test-license-key-nodejs"
309
+ nr_account_id = 12345
310
+
311
+ runtime = "nodejs20.x"
312
+
313
+ # --- Scenario 1: Standard Node.js Handler (ESM disabled) ---
314
+ print(f"\nTesting Node.js ({runtime}) Standard Handler...")
315
+ original_std_handler = "original_handler"
316
+ config_std = mock_function_config(runtime)
317
+
318
+ install_opts_std = layer_install(
319
+ session=session,
320
+ aws_region="us-east-1",
321
+ nr_account_id=nr_account_id,
322
+ enable_extension=True,
323
+ enable_extension_function_logs=True,
324
+ )
325
+
326
+ update_kwargs_std = _add_new_relic(
327
+ install_opts_std,
328
+ config_std,
329
+ nr_license_key=nr_license_key,
330
+ )
331
+
332
+ assert update_kwargs_std is not False, "Expected update_kwargs, not False"
333
+ assert (
334
+ update_kwargs_std["FunctionName"] == config_std["Configuration"]["FunctionArn"]
335
+ )
336
+ assert update_kwargs_std["Handler"] == "newrelic-lambda-wrapper.handler"
337
+ assert (
338
+ update_kwargs_std["Environment"]["Variables"]["NEW_RELIC_LAMBDA_HANDLER"]
339
+ == original_std_handler
340
+ )
341
+ assert update_kwargs_std["Environment"]["Variables"]["NEW_RELIC_ACCOUNT_ID"] == str(
342
+ nr_account_id
343
+ )
344
+ assert (
345
+ update_kwargs_std["Environment"]["Variables"]["NEW_RELIC_LICENSE_KEY"]
346
+ == nr_license_key
347
+ )
348
+ assert (
349
+ update_kwargs_std["Environment"]["Variables"][
350
+ "NEW_RELIC_LAMBDA_EXTENSION_ENABLED"
351
+ ]
352
+ == "true"
353
+ )
354
+ assert (
355
+ update_kwargs_std["Environment"]["Variables"][
356
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
357
+ ]
358
+ == "true"
359
+ )
360
+
361
+ # --- Scenario 2: ESM Node.js Handler (ESM enabled) ---
362
+ print(f"\nTesting Node.js ({runtime}) ESM Handler...")
363
+ original_esm_handler = "original_handler"
364
+ config_esm = mock_function_config(runtime)
365
+
366
+ install_opts_esm = layer_install(
367
+ session=session,
368
+ aws_region="us-east-1",
369
+ nr_account_id=nr_account_id,
370
+ enable_extension=True,
371
+ enable_extension_function_logs=True,
372
+ esm=True,
373
+ )
374
+
375
+ update_kwargs_esm = _add_new_relic(
376
+ install_opts_esm,
377
+ config_esm,
378
+ nr_license_key=nr_license_key,
379
+ )
380
+
381
+ assert update_kwargs_esm is not False, "Expected update_kwargs, not False"
382
+ assert (
383
+ update_kwargs_esm["FunctionName"] == config_esm["Configuration"]["FunctionArn"]
384
+ )
385
+ assert (
386
+ update_kwargs_esm["Handler"]
387
+ == "/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler"
388
+ )
389
+ assert (
390
+ update_kwargs_esm["Environment"]["Variables"]["NEW_RELIC_LAMBDA_HANDLER"]
391
+ == original_esm_handler
392
+ )
393
+ assert update_kwargs_esm["Environment"]["Variables"]["NEW_RELIC_ACCOUNT_ID"] == str(
394
+ nr_account_id
395
+ )
396
+ assert (
397
+ update_kwargs_esm["Environment"]["Variables"]["NEW_RELIC_LICENSE_KEY"]
398
+ == nr_license_key
399
+ )
400
+ assert (
401
+ update_kwargs_esm["Environment"]["Variables"][
402
+ "NEW_RELIC_LAMBDA_EXTENSION_ENABLED"
403
+ ]
404
+ == "true"
405
+ )
406
+ assert (
407
+ update_kwargs_esm["Environment"]["Variables"][
408
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
409
+ ]
410
+ == "true"
411
+ )
412
+
413
+
301
414
  @mock_aws
302
415
  def test_remove_new_relic(aws_credentials, mock_function_config):
303
416
  session = boto3.Session(region_name="us-east-1")