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

provider/aws: handle aws_lambda_function missing s3 key error #10960

Merged
merged 2 commits into from
Apr 1, 2017

Conversation

kung-foo
Copy link
Contributor

@kung-foo kung-foo commented Dec 29, 2016

This PR traps S3 Error Code: NoSuchKey as a non-retryable error when creating a new lambda function. Otherwise if the S3 key doesn't exist, then the function just loops for 10 minutes. I don't think this is the intended behavior.

The original code seemed to treat all InvalidParameterValueException as retryable, but the comment above it indicates that that was only for an IAM role propagation issue. So I've also added an explicit check for the IAM error.

I could also just remove the S3 check now that I have the explicit IAM check.

Side note, this came up because I was using aws_s3_bucket_object and that check was showing the object existed. aws_s3_bucket_object seems to allow a leading / whereas aws_lambda_function.s3_key does not.

-- jonathan

@bclodius
Copy link
Contributor

bclodius commented Feb 17, 2017

@kung-foo @apparentlymart any updates on this? I just faced this same issue scratching my head why my lambda functions were taking a while to create. In my case it was for InvalidParameterValueException: The role defined for the function cannot be assumed by Lambda. which is included in this PR but I think it should be a non-retryable error.

@radeksimko
Copy link
Member

Hi @kung-foo
sorry to keep you waiting here and thank you for the valuable contribution.

Since we're retrying on the error we tend to avoid ERROR log severity to avoid the feeling that something is wrong, when it's something that happens nearly every time during the creation of Lambda function.

Secondly I believe there's no need to treat S3 Error Code: NoSuchKey as a special case - if the error doesn't match, it will fall back to NonRetryableError anyway.

Finally there's another error which we need to retry on - InvalidParameterValueException: The provided execution role does not have permissions to call DescribeNetworkInterfaces on EC2 - that occurs if you try to create Lambda function in a VPC.

I made the mentioned tweaks in b8a7774 to speed things up. I hope you don't mind.

Your contribution is still included (and still credited to you), with the appropriate modifications. Feel free to ask about any of the changes.

@radeksimko radeksimko merged commit b8f6e2a into hashicorp:master Apr 1, 2017
@ghost
Copy link

ghost commented Apr 14, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants