-
Notifications
You must be signed in to change notification settings - Fork 30
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
fix: gracefully handle an error retrieving auth info from AWS Secrets Manager #401
fix: gracefully handle an error retrieving auth info from AWS Secrets Manager #401
Conversation
… Manager If there is an error retrieving an APM auth secret from AWS Secrets Manager (attempted when ELASTIC_APM_SECRETS_MANAGER_API_KEY_ID or ELASTIC_APM_SECRETS_MANAGER_SECRET_TOKEN_ID are provided), then the extension will now *log a warning* rather than erroring out. This allows the Lambda function to still work. Only the reporting of APM server data will fail (with a 403). This was already the behavior for an invalid ELASTIC_APM_SECRET_TOKEN.
cla/check |
Changes look good but I'm not sure we want to go in this direction.
I think the main difference is that this is not the responsibility of the extension. We can't know if the secre token is valid before sending data to APM. |
I disagree.
Given a lambda configured with A similar case is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @trentm. I agree with your assessment: runtime errors should not prevent the Lambda from executing.
Co-authored-by: Andrew Wilkins <[email protected]>
Thanks! |
If there is an error retrieving an APM auth secret from AWS Secrets
Manager (attempted when ELASTIC_APM_SECRETS_MANAGER_API_KEY_ID or ELASTIC_APM_SECRETS_MANAGER_SECRET_TOKEN_ID
are provided), then the extension will now log a warning rather
than erroring out.
This allows the Lambda function to still work. Only the reporting of
APM server data will fail (with a 403). This was already the behavior
for an invalid ELASTIC_APM_SECRET_TOKEN.
testing notes
first showing the failure
I configured a Lambda fn,
trentm-play-fn1
, to use the current latest extension and Node.js APM layers. I configured a bogus secret ID for a secret token:then I invoked the function (via its Lambda URL). It fails:
The full Lambda invocation log shows the extension erroring out
showing the fix
I updated this Lambda fn to use a dev build of this Lambda extension with these changes, published to
arn:aws:lambda:us-west-2:627286350134:layer:trentm-play-apm-lambda-extension:10
, and re-invoked. The Lambda function worked:The extension now warns with this, granted very wordy, log message:
and then later data sending fails with a 403.
The trimmed Lambda invocation log showing the warnings