Closed regoawt closed 6 months ago
Hey @regoawt thanks for reaching out 🙏
This looks very similar to #242 and it could be related to the function timing out.
I imagine you're deploying using SAR via CDK, right?
I'd suggest to deploy the latest Lambda Power Tuning without using SAR and check if you get a better invocation error.
@alexcasalboni thanks for the quick reply!
Will take a look at the linked issue. Yes I have deployed using SAR - will deploy the latest version using other means.
Managed to resolve the issue.
I still don't have a good explanation for why I was only getting the error when running the function through the Power Tuner, but as shown in the function error log, it was to do with the permissions of the Lambda package files. I found this issue: https://github.com/aws/aws-cdk/issues/8707#issuecomment-649310687 which pointed me in the right direction.
I had to configure the CDK bundling options of my function to give full permission to every file in the package using chmod
:
code=_lambda.Code.from_asset(
path=os.path.join(os.path.dirname(__file__), "src"),
bundling=BundlingOptions(
image=_lambda.Runtime.PYTHON_3_12.bundling_image,
command=[
"bash",
"-c",
"&&".join(
[
"pip install -r requirements.txt --no-deps --platform manylinux2014_x86_64 -t /asset-output",
"cp -au . /asset-output",
"chmod -R 777 /asset-output",
]
),
],
platform="linux/amd64",
),
),
PS it works with 755 permissions as per https://docs.aws.amazon.com/lambda/latest/dg/troubleshooting-deployment.html#troubleshooting-deployment-denied
Hi,
I have a Python Lambda function fronted with a function URL. I am able to invoke it without issue using
curl
or python requests.Expected behaviour
Power tuning tool runs without error
Actual behaviour
When I try and run it through the power tuning tool, it always fails with an Invocation Error:
Note I've removed the
errorMessage
item and truncated the list of numbers in the trace for brevity.Looking at the actual invocation logs of my Lambda function, I am getting a PermissionError:
Fixes attempted
I have tried to modify the file/directory permissions using
chmod
but that did not resolve anything, as described in this SO issue.Environment