Giter Site home page Giter Site logo

Comments (5)

kolanos avatar kolanos commented on July 28, 2024

@prasket Thanks for reporting this. We've considered disabling the permissions check by default. However, simulate_principal_policy appears to support IAM roles, so this is likely a bug.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/iam.html#IAM.Client.simulate_principal_policy

from newrelic-lambda-cli.

metaskills avatar metaskills commented on July 28, 2024

Hi Ken here from Custom Ink. Was going to update our New Relic stuff today and I think I ran into this issue. We use assumed roles too. I myself even have MFA setup on my profile, but that should be transparent to all other CLI usage. After getting the "The following AWS permissions are needed to install the New RElic AWS Lambda integration:" error I tried passing the --no-aws-permissions-check flag as this issue suggested and found I am getting a different error(s).

MIX "Bad API Key or no API Key provided" and "Could not retrieve license key from New Relic. Check that your New Relic Account ID is valid and try again."
Traceback (most recent call last):
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/newrelic_lambda_cli/api.py", line 321, in retrieve_license_key
    return gql.get_license_key()
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/newrelic_lambda_cli/api.py", line 100, in get_license_key
    accountId=self.account_id,
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/newrelic_lambda_cli/api.py", line 48, in query
    gql(query), timeout=timeout, variable_values=variable_values or None
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/gql/client.py", line 78, in execute
    raise Exception(str(result.errors[0]))
Exception: {'message': 'Bad API Key or no API Key provided'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/newrelic_lambda_cli/cli/integrations.py", line 94, in install
    nr_license_key = api.retrieve_license_key(gql_client)
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/newrelic_lambda_cli/api.py", line 326, in retrieve_license_key
    param="nr_account_id",
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 "/home/newrelic-lambda-cli/.local/bin/newrelic-lambda", line 8, in <module>
    sys.exit(main())
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/newrelic_lambda_cli/utils.py", line 23, in _boto_error_wrapper
    return func(*args, **kwargs)
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/newrelic_lambda_cli/cli/__init__.py", line 27, in main
    cli()
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/click/core.py", line 799, in main
    e.show()
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/site-packages/click/exceptions.py", line 73, in show
    echo("Error: {}".format(self.format_message()), file=file, color=color)
  File "/home/newrelic-lambda-cli/.local/lib/python3.7/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'

However I can confirm that my NR API Key is correct by making a test request.

curl -X GET 'https://api.newrelic.com/v2/applications.json' \
  -H 'X-Api-Key:NRAA-asdfsafasdfsafsadfasdfsdf' -I

from newrelic-lambda-cli.

kolanos avatar kolanos commented on July 28, 2024

@metaskills That is likely a separate issue from the one reported here. Can you verify your integrations are setup correctly in New Relic by following the steps here?
https://docs.newrelic.com/docs/integrations/amazon-integrations/get-started/connect-aws-infrastructure#connect

Specifically you'll want to verify your New Relic account and user in which your retrieving a license key for has the necessary permissions. For example, your New Relic user needs to be an owner, admin or an infra manager. Recommend contacting New Relic support for assistance.

from newrelic-lambda-cli.

metaskills avatar metaskills commented on July 28, 2024

@kolanos Thanks. I an an admin on both sides. I did find out my core issue is that we already had our AWS Account connected going back last year. So I think I got two rounds of errors that took me in the wrong direction. Again, appreciate your help and I hope I did not detract for the issue presented here by @prasket

from newrelic-lambda-cli.

kolanos avatar kolanos commented on July 28, 2024

Hi @prasket, we disabled the permissions check by default in: #115

Let us know if this didn't solve your issue. Thanks.

from newrelic-lambda-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.