Skip to content

Error "datadog:api key not configured" even though apiKeySecretArn is set #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
philipwigg opened this issue Apr 1, 2022 · 6 comments · Fixed by DataDog/datadog-lambda-js#280
Assignees

Comments

@philipwigg
Copy link

Expected Behavior

If I have apiKeySecretArn configured and the plugin is able to read the DD API key, I do not get an error in the logs complaining that

datadog:api key not configured, see https://dtdg.co/sls-node-metrics

Actual Behavior

I do receive an error that

datadog:api key not configured, see https://dtdg.co/sls-node-metrics

even though I don't need it to be configured because I'm using apiKeySecretArn as an alternative.

Specifications

  • Serverless Framework version: 3.10.-
  • Datadog Serverless Plugin version: 4.1.2
  • Lambda function runtime (Python 3.7, Node 10, etc.): Node 14
@philipwigg philipwigg changed the title datadog:api key not configure Error "datadog:api key not configured" even though apiKeySecretArn is set Apr 1, 2022
@astuyve
Copy link
Contributor

astuyve commented Apr 1, 2022

Hi @philipwigg - thanks for reaching out!
This message comes from dd-lambda-js

We did just release a fix for this, but looking at your reported plugin version - that fix should be in your deployed runtime. (landed in 4.1.1).

Would you mind confirming for me that the version of the Datadog NodeJS Lambda Layer is 74 or greater?

Thanks!

@philipwigg
Copy link
Author

philipwigg commented Apr 1, 2022

I'm not sure how to check the Lambda layer version, how do I do that?

I wonder if maybe this.isAgentRunning is still undefined at the point that the getAPIKey method is called? getAPIKey is called by the constructor whereas this.isAgentRunning seems to be set only when onStartInvocation is called? I am not much of a developer so sorry if this is totally wrong!

https://github.com/DataDog/datadog-lambda-js/blob/42f89c3294aaa261a1bd1c9768c40840fbada70b/src/metrics/listener.ts#L184

@astuyve
Copy link
Contributor

astuyve commented Apr 1, 2022

Hi @philipwigg! The easiest way is to log into the AWS console, go to the Lambda function, and then inspect the Layers section. A screenshot would be sufficient.

Thanks!

@philipwigg
Copy link
Author

Sure, here you go

image

@astuyve astuyve assigned astuyve and unassigned philipwigg Apr 1, 2022
@astuyve
Copy link
Contributor

astuyve commented Apr 1, 2022

Okay thanks - I'll look into this and get back to you!

@astuyve
Copy link
Contributor

astuyve commented Apr 5, 2022

Hi @philipwigg - there are a few things occurring here. It appears that apiKeySecretArn is not yet supported by datadog-lambda-js, which is why you're seeing the error.

This is only relevant to you if you're using sendDistributionMetricWithDate, which hits the API directly. Otherwise metrics are flushed to the extension (where apiKeySecretArn is supported).

We need to make several additional changes to support apiKeySecretArn. In the meantime, we should move this issue to https://github.com/DataDog/datadog-lambda-js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants