Skip to content

Executor Invocation Error due to permissions denied  #249

Closed
@regoawt

Description

@regoawt

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:

{
  "cause": {
    "errorType": "Error",
    "trace": [
      "Error: Invocation error (running in series): 123,34,101,114,114,111,114,77,101,115,115,97,103,101,34,58,32,34,91,69,114,114,110,111,32,49,51,93,32,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,58,32,39,47,118,97,114,47,116,97,115,107,47,109,97,105,110,46,112,121,39,34,44,32,34,101,11... with payload <redacted>",
      "    at runInSeries (/var/task/executor.js:167:19)",
      "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at async module.exports.handler (/var/task/executor.js:65:19)"
    ]
  },
  "error": "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:

{
    "timestamp": "2024-05-18T13:13:38Z",
    "log_level": "ERROR",
    "errorMessage": "[Errno 13] Permission denied: '/var/task/main.py'",
    "errorType": "PermissionError",
    "requestId": "",
    "stackTrace": [
        "  File \"/var/lang/lib/python3.12/importlib/__init__.py\", line 90, in import_module\n    return _bootstrap._gcd_import(name[level:], package, level)\n",
        "  File \"<frozen importlib._bootstrap>\", line 1387, in _gcd_import\n",
        "  File \"<frozen importlib._bootstrap>\", line 1360, in _find_and_load\n",
        "  File \"<frozen importlib._bootstrap>\", line 1331, in _find_and_load_unlocked\n",
        "  File \"<frozen importlib._bootstrap>\", line 935, in _load_unlocked\n",
        "  File \"<frozen importlib._bootstrap_external>\", line 991, in exec_module\n",
        "  File \"<frozen importlib._bootstrap_external>\", line 1128, in get_code\n",
        "  File \"<frozen importlib._bootstrap_external>\", line 1186, in get_data\n"
    ]
}

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

  • MacOS
  • The function is bundled, zipped and deployed with Python CDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions