Skip to content
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

Plugin requires AWS_PROFILE to be set in shell (or default profile) #2

Closed
chrisgilbert opened this issue Mar 16, 2022 · 2 comments
Closed

Comments

@chrisgilbert
Copy link

chrisgilbert commented Mar 16, 2022

Thanks for sharing your plugin!

I had a bit of trouble getting it to work initially - I found that I needed to make sure the AWS_PROFILE variable was set in the shell to get the API call to work to API gateway.

We are passing --aws-profile as a custom option in our deployment toolchain, which we use to set profile on the provider, and that didn't work with this plugin, probably because of the direct call with the SDK here: https://github.com/dvla/serverless-apigateway-log-retention/blob/master/src/serverlessApigatewayLogRetentionPlugin.js#L23

Once I set AWS_PROFILE in the shell everywhere, it worked OK.

However, in the end I actually found serverless framework can set the log retention itself on the provider for API gateway, though it doesn't seem to be documented on the configuration page - see here:

https://github.com/serverless/serverless/blob/v2/lib/plugins/aws/package/compile/events/apiGateway/lib/stage.js#L113

I ended up not needing to use this plugin, because of the logRetentionInDays parameter: https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml#general-function-settings

So if anyone needs to set just a single log retention value for both lambda and API gateway, that's the simplest option.

I missed that when reading the API gateway docs, so just thought I'd let you know in case it's useful to you or anyone else.

The same goes for the serverless-plugin-log-retention which now does exactly the same thing as serverless core as far as I can tell.

@deepakthankachan
Copy link
Contributor

I couldn't use the logRetentionInDays property to set the execution log retention. Not sure if they support this now.

@deepakthankachan
Copy link
Contributor

Fixed under this PR

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

No branches or pull requests

2 participants