zappa / Zappa

Serverless Python
https://zappa.ws/zappa
MIT License
3.33k stars 363 forks source link

Manually created API Gateway method not working after zappa update #1285

Closed KenSentMe closed 7 months ago

KenSentMe commented 11 months ago

Context

We use zappa to deploy our Django api. I wanted to enable caching on one of the endpoints in API Gateway. In API Gateway I created the required resources and GET method and linked it to my Lambda function. After that in the Method request tab I created the necessary URL query string parameters and in the Integration request tab enabled Lambda proxy integration.

This all works fine. Requests with a given query parameter are cached correctly. However, when I run zappa update to push some new code, the method I created isn't working anymore. To get it working again, I have to remove the method, create it again and the deploy it (all is done in API Gateway). Is there a way to circumvent this using Zappa or should I look into AWS settings for this?

Expected Behavior

I expect the endpoint method to keep working, because no setting has changed (I re-create the method with the exact same settings)

Actual Behavior

See above

Your Environment

aiohttp==3.9.0
aiosignal==1.3.1
annotated-types==0.5.0
argcomplete==3.1.1
asgiref==3.7.2
async-timeout==4.0.3
attrs==23.1.0
aws-psycopg2==1.3.8
beautifulsoup4==4.12.2
bleach==6.0.0
blis==0.7.10
boto3==1.28.37
botocore==1.31.37
cachetools==5.3.1
catalogue==2.0.9
certifi==2023.7.22
cffi==1.15.1
cfgv==3.4.0
cfn-flip==1.3.0
charset-normalizer==3.2.0
click==8.1.7
colorama==0.4.6
confection==0.1.1
cryptography==41.0.4
cymem==2.0.7
defusedxml==0.7.1
distlib==0.3.7
dj-rest-auth==4.0.1
Django==4.2.7
django-allauth==0.54.0
django-annoying==0.10.6
django-constance==3.1.0
django-cors-headers==4.2.0
django-extensions==3.2.3
django-generate-secret-key==1.0.2
django-jsonform==2.19.0
django-resized==1.0.2
django-s3-storage==0.14.0
django-sql-dashboard==1.1
djangorestframework==3.14.0
drf-spectacular==0.26.4
durationpy==0.5
exceptiongroup==1.1.3
filelock==3.12.3
frozenlist==1.4.0
google-api-core==2.11.1
google-api-python-client==2.48.0
google-auth==2.22.0
google-auth-httplib2==0.1.0
google-cloud-core==2.3.3
google-cloud-texttospeech==2.14.1
google-cloud-translate==3.12.0
googleapis-common-protos==1.60.0
grpcio==1.53.0
grpcio-status==1.53.0
grpcio-tools==1.53.0
hjson==3.1.0
httplib2==0.22.0
identify==2.5.27
idna==3.4
inflection==0.5.1
iniconfig==2.0.0
Jinja2==3.1.2
jmespath==1.0.1
jsonschema==4.19.0
jsonschema-specifications==2023.7.1
kappa==0.6.0
langcodes==3.3.0
Markdown==3.4.4
MarkupSafe==2.1.3
multidict==6.0.4
murmurhash==1.0.9
nodeenv==1.8.0
numpy==1.25.2
oauthlib==3.2.2
openai==1.3.5
packaging==23.1
param==1.13.0
pathy==0.10.2
Pillow==10.0.1
placebo==0.9.0
platformdirs==3.10.0
pluggy==1.3.0
pre-commit==3.3.3
preshed==3.0.8
proto-plus==1.22.3
protobuf==4.21.12
psycopg2-binary==2.9.7
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycparser==2.21
pydantic==2.3.0
pydantic_core==2.6.3
pyfiglet==0.8.post1
PyJWT==2.8.0
pyparsing==3.1.1
pyphen==0.14.0
pytest==7.4.0
pytest-django==4.5.2
python-dateutil==2.8.2
python-dotenv==1.0.0
python-resize-image==1.1.20
python-slugify==8.0.1
python3-openid==3.2.0
pytz==2023.3
PyYAML==6.0.1
referencing==0.30.2
requests==2.31.0
requests-oauthlib==1.3.1
rpds-py==0.10.0
rsa==4.9
s3transfer==0.6.2
shortuuid==1.0.11
six==1.16.0
smart-open==6.3.0
soupsieve==2.4.1
spacy==3.6.1
spacy-legacy==3.0.12
spacy-loggers==1.0.4
spacy-syllables==3.0.2
sqlparse==0.4.4
srsly==2.4.7
stability-sdk==0.8.4
termcolor==1.1.0
text-unidecode==1.3
thinc==8.1.12
toml==0.10.2
tomli==2.0.1
tqdm==4.66.1
troposphere==4.4.1
typer==0.9.0
typing_extensions==4.7.1
tzdata==2023.3
uritemplate==4.1.1
urllib3==1.26.18
vcrpy==5.1.0
virtualenv==20.24.3
wasabi==1.1.2
webencodings==0.5.1
werkzeug>=3.0.1
# windows-curses==2.3.1
yarl==1.9.2
zappa==0.57.0
{
  "development": {
    "aws_region": "eu-central-1",
    "django_settings": "my_project.settings",
    "project_name": "app",
    "runtime": "python3.10",
    "s3_bucket": "zappa-lambda-my_project",
    "environment_variables": {
      "ENVIRONMENT": "DEV",
      "SETTINGS_FILE": "envs/.dev.json"
    },
    "exclude": ["venv", "*.sqlite3", "scripts", "datadump.json"],
    "slim_handler": true,
    "keep_warm": true,
    "timeout_seconds": 300,
    "memory_size": 2000,
    "log_level": "DEBUG",
    "cloudwatch_log_level": "DEBUG"
  },
  "production": {
    "aws_region": "eu-central-1",
    "django_settings": "my_project.settings",
    "project_name": "zappa-lambda-my_project",
    "runtime": "python3.10",
    "s3_bucket": "zappa-lambda-my_project",
    "environment_variables": {
      "ENVIRONMENT": "PROD",
      "SETTINGS_FILE": "envs/.prod.json"
    },
    "exclude": ["venv", "*.sqlite3", "scripts", "datadump.json"],
    "slim_handler": true,
    "keep_warm": true,
    "timeout_seconds": 600,
    "memory_size": 3000,
    "log_level": "ERROR",
    "cloudwatch_log_level": "INFO"
  }
}
monkut commented 11 months ago

Is there any error on deploy/update?

KenSentMe commented 11 months ago

None that I can see. We set up Github actions for deploy/update. This is the last bit of the output:

Packaging project as zip.

Uploading xxx-production-1700735655.tar.gz (134.7MiB)..
  0%|          | 0.00/141M [00:00<?, ?B/s]
  0%|          | 262k/141M [00:00<05:03, 465kB/s]
  1%|          | 1.05M/141M [00:00<01:16, 1.84MB/s]
  2%|▏         | 2.36M/141M [00:00<00:35, 3.96MB/s]
  3%|▎         | 4.46M/141M [00:00<00:18, 7.22MB/s]
  4%|▍         | 6.29M/141M [00:01<00:14, 9.08MB/s]
  6%|▌         | 8.65M/141M [00:01<00:14, 9.19MB/s]
  9%|▉         | 12.8M/141M [00:01<00:08, 15.2MB/s]
 13%|█▎        | 18.1M/141M [00:01<00:05, 23.1MB/s]
 19%|█▉        | 26.5M/141M [00:01<00:03, 37.3MB/s]
 24%|██▍       | 34.1M/141M [00:01<00:02, 46.6MB/s]
 33%|███▎      | 46.9M/141M [00:01<00:01, 67.6MB/s]
 44%|████▍     | 62.1M/141M [00:01<00:00, 89.4MB/s]
 56%|█████▌    | 78.4M/141M [00:02<00:00, 109MB/s] 
 68%|██████▊   | 95.7M/141M [00:02<00:00, 125MB/s]
 77%|███████▋  | 109M/141M [00:02<00:00, 105MB/s] 
 77%|███████▋  | 109M/141M [00:02<00:00, 94.4MB/s]
 86%|████████▌ | 121M/141M [00:02<00:00, 97.4MB/s]
 95%|█████████▍| 134M/141M [00:02<00:00, 104MB/s] 
100%|██████████| 141M/141M [00:03<00:00, 45.8MB/s]
Uploading handler_xxx-production-1700735774.zip (17.8MiB)..

  0%|          | 0.00/18.7M [00:00<?, ?B/s]
  1%|▏         | 262k/18.7M [00:00<00:16, 1.11MB/s]
  3%|▎         | 524k/18.7M [00:00<00:10, 1.77MB/s]
 48%|████▊     | 8.91M/18.7M [00:00<00:00, 23.2MB/s]
 49%|████▉     | 9.18M/18.7M [00:00<00:00, 40.2MB/s]
 80%|████████  | 15.0M/18.7M [00:00<00:00, 39.1MB/s]
100%|██████████| 18.7M/18.7M [00:00<00:00, 21.6MB/s]
Updating Lambda function code..
Waiting for lambda function [xxx-production] to be updated...
Updating Lambda function configuration..
Uploading xxx-production-template-1700735792.json (1.7KiB)..

  0%|          | 0.00/1.71k [00:00<?, ?B/s]
100%|██████████| 1.71k/1.71k [00:00<00:00, 8.31kB/s]
100%|██████████| 1.71k/1.71k [00:00<00:00, 8.28kB/s]
Deploying API Gateway..
Scheduling..
Unscheduled xxx-zappa-keep-warm-handler.keep_warm_callback.
Scheduled xxx-zappa-keep-warm-handler.keep_warm_callback with expression rate(4 minutes)!
Waiting for lambda function [xxx-production] to be updated...
Your updated Zappa deployment is live!: https://xxx.execute-api.eu-central-1.amazonaws.com/production
github-actions[bot] commented 7 months ago

Hi there! Unfortunately, this Issue has not seen any activity for at least 90 days. If the Issue is still relevant to the latest version of Zappa, please comment within the next 10 days if you wish to keep it open. Otherwise, it will be automatically closed.

github-actions[bot] commented 7 months ago

Hi there! Unfortunately, this Issue was automatically closed as it had not seen any activity in at least 100 days. If the Issue is still relevant to the latest version of Zappa, please open a new Issue.