-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Better Lambda error #13709
Comments
Any updates on this. We are facing the same issue, and have no idea why. works in cli, so we need the real error message from terraform. |
@mac-transamerica FWIW both my problem and the linked problem was using IAM Role name instead of IAM Role ARN. Something to check. |
I'm stuck on the same error. Already spent over 2 hours trying to figure this out, these errors really need to provide more details. Ideally, validation should be checked during plan. resource "aws_lambda_function" "json_upload" {
filename = local.archive_file_path
function_name = local.function_name
role = aws_iam_role.json_upload.arn
description = "Uploads a JSON file to the S3 bucket"
runtime = "java11"
memory_size = 256
handler = "myhandler"
source_code_hash = data.archive_file.lambda_zip.output_base64sha256
vpc_config {
subnet_ids = var.subnet_ids
security_group_ids = [
aws_security_group.json_upload.id,
]
}
environment {
variables = {
"MY_VAR" = trimspace(rsadecrypt((var.my_var), file("my.key")))
}
}
lifecycle {
ignore_changes = [
source_code_hash,
]
}
} |
+1 |
This happens when invoking a lambda from within another lambda |
I've had this error for many reasons, and have spent countless hours trying to figure it out each time. Please fix this hashicorp, as lambdas are becoming critical infrastructure, and we need actual error to be able to resolve. |
Stuck on this for 2 hours now, no idea what's wrong. I wouldn't mind if it was during plan, but now I have to apply change every time just to check. |
It's just sad the error message is so unhelpful and provides no insight whatsoever. This is something that must be addressed as soon as possible. The amount of time spent trying to troubleshoot an error that you can find no correlation anywhere is absurd. |
I will actually retract my comment. In fact, what stinks is the AWS API response. I redacted the information of the execution in debug mode, but clearly, we can see the lack of any meaningful field in the response data.
Although the client response is good :-(
|
I have just wasted at least half a day trying to get to the root cause of
|
TL;DR I think we have some compatibility problem between AWS SDK/API and the underlying AWS service for Lambda. Faced with an obvious discrepancy in error reporting by AWS CLI and Terraform, I decided to dig a bit deeper. Here's the API response, taken from the Terraform debug log:
Apparently there's 147 bytes of JSON content, which must be an encoded error message, which the provider needs to extract and return to Terraform. But the provider seems to throw away the error message and then we simply get a "computer says no" in the console:
So I tried to obtain the content of that error message. Running my AWS CLI command with
And if I copy the request parameters from Terraform debug log and stick them into an HTTP client, I get a similar response:
But AWS API for Likewise, So I suspect that somehow Lambda service sends back an error type that is not part of the schema for Lambda API, and hence it is not recognised by |
In my case it was name of the lambda function which was incorrect. I was using spaces and that's not allowed. |
Same for me. The function name and handler had invalid characters. Once I did that the error went away. |
Using |
The issue for me was having a comma in the tag value It's simply to do validation when it's already shown and the same programming language Poor effort when you look at a thread like this and feel the pain yourself it makes it blatantly obvious Hashicorp are not interested in maintaining good 'fundamental' tools anymore, their too focused on shiny new stuff |
For my case environment variable got extra space to spend an hour looking at it. |
In my case, it was about |
I've been attempting to replicate my Terraform plan with the AWS CLI, but when doing so the AWS CLI lambda create-function command creates the function successfully, whereas Terraform Cloud apply will fail with a nondescript ValidationException. Here is a description of my specific case: https://stackoverflow.com/questions/74561968/terraform-cloud-apply-lambda-function-fails-with-validationexception-aws-cli-la This is extremely frustrating and makes it practically impossible to effectively debug whatever issue I might be running into with validation. Edit: It turns out that in |
Please deliver this, also lost precious hours debugging this |
This may be an upstream issue in the While we await a response on the bug report, we'll also investigate updating to V2 of the AWS Go SDK for the Lambda function resource. |
Hi everyone, I have posted my findings on the aws/aws-sdk-go#4733 thread. Apologies for the inconveniences, |
This functionality has been released in v4.56.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
When creating a Lambda function, I get
I had used role name instead of role ARN. Does the API provide any further detail than status code 400 about the problem? If so, we should display that.
See also https://discuss.hashicorp.com/t/error-creating-lambda-function-validationexception/8192/3
The text was updated successfully, but these errors were encountered: