Skip to content

The role defined for the function cannot be assumed by Lambda. #1361

@nigeljames-tess

Description

@nigeljames-tess

Context

I was deploying a simple (admin) only django install to test zappa and the zappa init was fine but on my first run of zappa deploy dev I go the error in the title

Python 3.12

Expected Behavior

I expected to get through to Deployment complete

Actual Behavior

An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: The role defined for the function cannot be assumed by Lambda.

Possible Fix

https://stackoverflow.com/a/37438525/2434654 this link suggested sleeping a few seconds so I tried it again and it got to Deployment complete.

Perhaps introduce a pause in the deployment after the upload to wait for the role to be ready if others have this issue.

Steps to Reproduce

  1. Step up super basic django
  2. set up database (possibly not required)
  3. setup amazon account to deploy ( i used sso)
  4. zappa init
  5. zappa deploy dev

Your Environment

  • Zappa version used: 0.59.0
  • Operating System and Python version: MacOS 15.2
  • The output of pip freeze:
argcomplete==3.5.3
asgiref==3.8.1
boto3==1.35.95
botocore==1.35.95
certifi==2024.12.14
cfn-flip==1.3.0
charset-normalizer==3.4.1
click==8.1.8
django==5.1.4
durationpy==0.9
hjson==3.1.0
idna==3.10
jmespath==1.0.1
kappa==0.6.0
markupsafe==3.0.2
pip==24.3.1
placebo==0.9.0
psycopg==3.2.3
psycopg-binary==3.2.3
python-dateutil==2.9.0.post0
python-slugify==8.0.4
pyyaml==6.0.2
requests==2.32.3
s3transfer==0.10.4
setuptools==75.8.0
six==1.17.0
sqlparse==0.5.3
text-unidecode==1.3
toml==0.10.2
tqdm==4.67.1
troposphere==4.8.3
typing-extensions==4.12.2
urllib3==2.3.0
werkzeug==3.1.3
wheel==0.45.1
zappa==0.59.0
  • Link to your project (optional):
  • Your zappa_settings.json:
{
    "dev": {
        "aws_region": "ap-southeast-2",
        "django_settings": "project.settings",
        "exclude": [
            "boto3",
            "dateutil",
            "botocore",
            "s3transfer",
            "concurrent"
        ],
        "profile_name": "default",
        "project_name": "unity",
        "runtime": "python3.12",
        "s3_bucket": "random-name"
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-closed[Bot] Closed, details in commentsno-activity[Bot] Closing soon if no new activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions