newrelic-lambda-cli 0.9.4__tar.gz → 0.9.6__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.4 → newrelic_lambda_cli-0.9.6}/PKG-INFO +21 -8
  2. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/README.md +10 -6
  3. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/cli/layers.py +6 -0
  4. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/layers.py +7 -0
  5. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/types.py +1 -0
  6. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/utils.py +12 -0
  7. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli.egg-info/PKG-INFO +21 -8
  8. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/setup.py +1 -1
  9. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/tests/test_layers.py +113 -0
  10. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/CODE_OF_CONDUCT.md +0 -0
  11. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/CONTRIBUTING.md +0 -0
  12. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/LICENSE +0 -0
  13. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/MANIFEST.in +0 -0
  14. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/THIRD_PARTY_NOTICES.md +0 -0
  15. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/__init__.py +0 -0
  16. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/api.py +0 -0
  17. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/cli/__init__.py +0 -0
  18. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/cli/decorators.py +0 -0
  19. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/cli/functions.py +0 -0
  20. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/cli/integrations.py +0 -0
  21. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/cli/otel_ingestions.py +0 -0
  22. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/cli/subscriptions.py +0 -0
  23. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/cliutils.py +0 -0
  24. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/functions.py +0 -0
  25. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/integrations.py +0 -0
  26. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/otel_ingestions.py +0 -0
  27. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/permissions.py +0 -0
  28. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/subscriptions.py +0 -0
  29. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/templates/import-template.yaml +0 -0
  30. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/templates/license-key-secret.yaml +0 -0
  31. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli/templates/nr-lambda-integration-role.yaml +0 -0
  32. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli.egg-info/SOURCES.txt +0 -0
  33. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli.egg-info/dependency_links.txt +0 -0
  34. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli.egg-info/entry_points.txt +0 -0
  35. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli.egg-info/not-zip-safe +0 -0
  36. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli.egg-info/requires.txt +0 -0
  37. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/newrelic_lambda_cli.egg-info/top_level.txt +0 -0
  38. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/pyproject.toml +0 -0
  39. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/setup.cfg +0 -0
  40. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/tests/test_api.py +0 -0
  41. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/tests/test_functions.py +0 -0
  42. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/tests/test_integrations.py +0 -0
  43. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/tests/test_new_relic_gql.py +0 -0
  44. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/tests/test_permissions.py +0 -0
  45. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/tests/test_subscriptions.py +0 -0
  46. {newrelic_lambda_cli-0.9.4 → newrelic_lambda_cli-0.9.6}/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.4
3
+ Version: 0.9.6
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,10 +14,19 @@ 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
 
20
- # newrelic-lambda-cli [![Build Status](https://circleci.com/gh/newrelic/newrelic-lambda-cli.svg?style=svg)](https://circleci.com/gh/newrelic/newrelic-lambda-cli) [![Coverage](https://codecov.io/gh/newrelic/newrelic-lambda-cli/branch/master/graph/badge.svg?token=1Rl7h0O1JJ)](https://codecov.io/gh/newrelic/newrelic-lambda-cli)
29
+ # newrelic-lambda-cli [![Build Status](https://github.com/newrelic/newrelic-lambda-cli/actions/workflows/build-test-release.yml/badge.svg)](https://github.com/newrelic/newrelic-lambda-cli/actions/workflows/build-test-release.yml) [![Coverage](https://codecov.io/gh/newrelic/newrelic-lambda-cli/branch/master/graph/badge.svg?token=1Rl7h0O1JJ)](https://codecov.io/gh/newrelic/newrelic-lambda-cli)
21
30
 
22
31
  A CLI to install the New Relic AWS Lambda integration and layers.
23
32
 
@@ -63,6 +72,7 @@ A CLI to install the New Relic AWS Lambda integration and layers.
63
72
  * nodejs16.x
64
73
  * nodejs18.x
65
74
  * nodejs20.x
75
+ * nodejs22.x
66
76
  * provided
67
77
  * provided.al2
68
78
  * provided.al2023
@@ -72,8 +82,10 @@ A CLI to install the New Relic AWS Lambda integration and layers.
72
82
  * python3.10
73
83
  * python3.11
74
84
  * python3.12
85
+ * python3.13
75
86
  * ruby3.2
76
87
  * ruby3.3
88
+ * ruby3.4
77
89
 
78
90
  **Note:** Automatic handler wrapping is only supported for Node.js, Python, Java, and Ruby. For other runtimes,
79
91
  manual function wrapping is required using the runtime specific New Relic agent.
@@ -170,8 +182,8 @@ newrelic-lambda integrations update \
170
182
 
171
183
  | Option | Required? | Description |
172
184
  |--------|-----------|-------------|
173
- | `--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. |
174
- | `--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. |
175
187
  | `--disable-logs` or `-d` | No | Disables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ...` afterwards. |
176
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. |
177
189
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. |
@@ -208,6 +220,7 @@ newrelic-lambda layers install \
208
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. |
209
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. |
210
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`. |
211
224
 
212
225
  #### Uninstall Layer
213
226
 
@@ -343,11 +356,11 @@ newrelic-lambda subscriptions uninstall --function <name or arn> --otel
343
356
 
344
357
  ## Docker
345
358
 
346
- 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).
347
360
 
348
361
  ```bash
349
- docker build -t newrelic-lambda-cli .
350
- 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
351
364
  ```
352
365
 
353
366
  ## Contributing
@@ -1,6 +1,6 @@
1
1
  [![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)
2
2
 
3
- # newrelic-lambda-cli [![Build Status](https://circleci.com/gh/newrelic/newrelic-lambda-cli.svg?style=svg)](https://circleci.com/gh/newrelic/newrelic-lambda-cli) [![Coverage](https://codecov.io/gh/newrelic/newrelic-lambda-cli/branch/master/graph/badge.svg?token=1Rl7h0O1JJ)](https://codecov.io/gh/newrelic/newrelic-lambda-cli)
3
+ # newrelic-lambda-cli [![Build Status](https://github.com/newrelic/newrelic-lambda-cli/actions/workflows/build-test-release.yml/badge.svg)](https://github.com/newrelic/newrelic-lambda-cli/actions/workflows/build-test-release.yml) [![Coverage](https://codecov.io/gh/newrelic/newrelic-lambda-cli/branch/master/graph/badge.svg?token=1Rl7h0O1JJ)](https://codecov.io/gh/newrelic/newrelic-lambda-cli)
4
4
 
5
5
  A CLI to install the New Relic AWS Lambda integration and layers.
6
6
 
@@ -46,6 +46,7 @@ A CLI to install the New Relic AWS Lambda integration and layers.
46
46
  * nodejs16.x
47
47
  * nodejs18.x
48
48
  * nodejs20.x
49
+ * nodejs22.x
49
50
  * provided
50
51
  * provided.al2
51
52
  * provided.al2023
@@ -55,8 +56,10 @@ A CLI to install the New Relic AWS Lambda integration and layers.
55
56
  * python3.10
56
57
  * python3.11
57
58
  * python3.12
59
+ * python3.13
58
60
  * ruby3.2
59
61
  * ruby3.3
62
+ * ruby3.4
60
63
 
61
64
  **Note:** Automatic handler wrapping is only supported for Node.js, Python, Java, and Ruby. For other runtimes,
62
65
  manual function wrapping is required using the runtime specific New Relic agent.
@@ -153,8 +156,8 @@ newrelic-lambda integrations update \
153
156
 
154
157
  | Option | Required? | Description |
155
158
  |--------|-----------|-------------|
156
- | `--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. |
157
- | `--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. |
158
161
  | `--disable-logs` or `-d` | No | Disables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ...` afterwards. |
159
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. |
160
163
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. |
@@ -191,6 +194,7 @@ newrelic-lambda layers install \
191
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. |
192
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. |
193
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`. |
194
198
 
195
199
  #### Uninstall Layer
196
200
 
@@ -326,11 +330,11 @@ newrelic-lambda subscriptions uninstall --function <name or arn> --otel
326
330
 
327
331
  ## Docker
328
332
 
329
- 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).
330
334
 
331
335
  ```bash
332
- docker build -t newrelic-lambda-cli .
333
- 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
334
338
  ```
335
339
 
336
340
  ## Contributing
@@ -103,6 +103,12 @@ def register(group):
103
103
  show_default=True,
104
104
  type=click.Choice(["handleRequest", "handleStreamsRequest"]),
105
105
  )
106
+ @click.option(
107
+ "--esm",
108
+ default=False,
109
+ show_default=True,
110
+ help="Nodejs runtimes only - nodejs implementation runtime handler to /opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler",
111
+ )
106
112
  @click.pass_context
107
113
  def install(ctx, **kwargs):
108
114
  """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"]
@@ -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 = [
@@ -40,6 +40,10 @@ RUNTIME_CONFIG = {
40
40
  "Handler": "newrelic-lambda-wrapper.handler",
41
41
  "LambdaExtension": True,
42
42
  },
43
+ "nodejs22.x": {
44
+ "Handler": "newrelic-lambda-wrapper.handler",
45
+ "LambdaExtension": True,
46
+ },
43
47
  "provided": {"LambdaExtension": True},
44
48
  "provided.al2": {"LambdaExtension": True},
45
49
  "provided.al2023": {"LambdaExtension": True},
@@ -67,6 +71,10 @@ RUNTIME_CONFIG = {
67
71
  "Handler": "newrelic_lambda_wrapper.handler",
68
72
  "LambdaExtension": True,
69
73
  },
74
+ "python3.13": {
75
+ "Handler": "newrelic_lambda_wrapper.handler",
76
+ "LambdaExtension": True,
77
+ },
70
78
  "ruby3.2": {
71
79
  "Handler": "newrelic_lambda_wrapper.handler",
72
80
  "LambdaExtension": True,
@@ -75,6 +83,10 @@ RUNTIME_CONFIG = {
75
83
  "Handler": "newrelic_lambda_wrapper.handler",
76
84
  "LambdaExtension": True,
77
85
  },
86
+ "ruby3.4": {
87
+ "Handler": "newrelic_lambda_wrapper.handler",
88
+ "LambdaExtension": True,
89
+ },
78
90
  }
79
91
 
80
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.4
3
+ Version: 0.9.6
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,10 +14,19 @@ 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
 
20
- # newrelic-lambda-cli [![Build Status](https://circleci.com/gh/newrelic/newrelic-lambda-cli.svg?style=svg)](https://circleci.com/gh/newrelic/newrelic-lambda-cli) [![Coverage](https://codecov.io/gh/newrelic/newrelic-lambda-cli/branch/master/graph/badge.svg?token=1Rl7h0O1JJ)](https://codecov.io/gh/newrelic/newrelic-lambda-cli)
29
+ # newrelic-lambda-cli [![Build Status](https://github.com/newrelic/newrelic-lambda-cli/actions/workflows/build-test-release.yml/badge.svg)](https://github.com/newrelic/newrelic-lambda-cli/actions/workflows/build-test-release.yml) [![Coverage](https://codecov.io/gh/newrelic/newrelic-lambda-cli/branch/master/graph/badge.svg?token=1Rl7h0O1JJ)](https://codecov.io/gh/newrelic/newrelic-lambda-cli)
21
30
 
22
31
  A CLI to install the New Relic AWS Lambda integration and layers.
23
32
 
@@ -63,6 +72,7 @@ A CLI to install the New Relic AWS Lambda integration and layers.
63
72
  * nodejs16.x
64
73
  * nodejs18.x
65
74
  * nodejs20.x
75
+ * nodejs22.x
66
76
  * provided
67
77
  * provided.al2
68
78
  * provided.al2023
@@ -72,8 +82,10 @@ A CLI to install the New Relic AWS Lambda integration and layers.
72
82
  * python3.10
73
83
  * python3.11
74
84
  * python3.12
85
+ * python3.13
75
86
  * ruby3.2
76
87
  * ruby3.3
88
+ * ruby3.4
77
89
 
78
90
  **Note:** Automatic handler wrapping is only supported for Node.js, Python, Java, and Ruby. For other runtimes,
79
91
  manual function wrapping is required using the runtime specific New Relic agent.
@@ -170,8 +182,8 @@ newrelic-lambda integrations update \
170
182
 
171
183
  | Option | Required? | Description |
172
184
  |--------|-----------|-------------|
173
- | `--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. |
174
- | `--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. |
175
187
  | `--disable-logs` or `-d` | No | Disables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ...` afterwards. |
176
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. |
177
189
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. |
@@ -208,6 +220,7 @@ newrelic-lambda layers install \
208
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. |
209
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. |
210
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`. |
211
224
 
212
225
  #### Uninstall Layer
213
226
 
@@ -343,11 +356,11 @@ newrelic-lambda subscriptions uninstall --function <name or arn> --otel
343
356
 
344
357
  ## Docker
345
358
 
346
- 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).
347
360
 
348
361
  ```bash
349
- docker build -t newrelic-lambda-cli .
350
- 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
351
364
  ```
352
365
 
353
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.4",
9
+ version="0.9.6",
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")