Newrelic-lambda integrations

I am triyng to link my new relic one account (free one, so I am the only user). I have created the API key using the UI and I am quite sure I am copy pasting it correctly below (and same for the account id).

I keep getting the error message shown below.

newrelic-lambda integrations install --nr-account-id xxxx --linked-account-name nr_aws_lambda_link --nr-api-key yyyyy --enable-license-key-secret

Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/newrelic_lambda_cli/api.py”, line 321, in retrieve_license_key
return gql.get_license_key()
File “/usr/local/lib/python3.8/site-packages/newrelic_lambda_cli/api.py”, line 85, in get_license_key
res = self.query(
File “/usr/local/lib/python3.8/site-packages/newrelic_lambda_cli/api.py”, line 47, in query
return self.client.execute(
File “/usr/local/lib/python3.8/site-packages/gql/client.py”, line 78, in execute
raise Exception(str(result.errors[0]))
Exception: {‘extensions’: {‘error_code’: ‘BAD_API_KEY’}, ‘message’: ‘Bad API Key or no API Key provided’}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.8/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.8/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python3.8/site-packages/newrelic_lambda_cli/cli/integrations.py”, line 100, in install
nr_license_key = api.retrieve_license_key(gql_client)
File “/usr/local/lib/python3.8/site-packages/newrelic_lambda_cli/api.py”, line 323, in retrieve_license_key
raise click.BadParameter(
click.exceptions.BadParameter: Could not retrieve license key from New Relic. Check that your New Relic Account ID is valid and try again.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/bin/newrelic-lambda”, line 8, in
sys.exit(main())
File “/usr/local/lib/python3.8/site-packages/newrelic_lambda_cli/utils.py”, line 23, in _boto_error_wrapper
return func(*args, **kwargs)
File “/usr/local/lib/python3.8/site-packages/newrelic_lambda_cli/cli/init.py”, line 27, in main
cli()
File “/usr/local/lib/python3.8/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.8/site-packages/click/core.py”, line 799, in main
e.show()
File “/usr/local/lib/python3.8/site-packages/click/exceptions.py”, line 73, in show
echo(“Error: {}”.format(self.format_message()), file=file, color=color)
File “/usr/local/lib/python3.8/site-packages/click/exceptions.py”, line 103, in format_message
param_hint = self.param.get_error_hint(self.ctx)
AttributeError: ‘str’ object has no attribute ‘get_error_hint’

@devang.mehta2 thanks for posting. May I ask where you’re getting the API key? The integration requires a Personal API key, which can be a bit tricky to retrieve after some of the recent changes in the UI. In NR1, the best way is to use the “AWS Lambda Setup” nerdlet, which will allow you to generate a fresh API key.

Let us know how this goes!

@scandela , thanks for your response. I have a new relic one free account. And in the UI, there seems to be only one way to get the API key. See attached screenshot.

I tried to use the nerdgraph in my browser but could not get it to work. There was a drop down to generate keys, I think but it did not respond.

It looks like above is not the ‘personal’ api key. I have tried once again to generate personal api key from here: https://api.newrelic.com/graphiql

I can see the console. It says that the query builder is loading but the loading never finishes. I don’t see any warnings for pop up blocker. And ‘create new api key’ in the dropdown does nothing.

I have tried the above on both firefox and chrome.

Hi there @devang.mehta2 - thanks for your patience with us. I just realized that your account is based in the EU. To generate an API key for your account, you need a slightly different URL: https://api.eu.newrelic.com/graphql.

Please let me know if this does not resolve things for you.