Skip to content
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

SNS Environment Error with the new version of zappa 0.37.0 #684

Closed
MrMitch17 opened this issue Feb 21, 2017 · 8 comments
Closed

SNS Environment Error with the new version of zappa 0.37.0 #684

MrMitch17 opened this issue Feb 21, 2017 · 8 comments

Comments

@MrMitch17
Copy link

Ran pip --upgrade zappa and now I am getting this error on a deployment that was working when running zappa update.

Scheduling..
Unscheduled em7anno-zap-prod-zappa-keep-warm-handler.keep_warm_callback.
ERROR:Unable to remove lambda execute permission to SNS event source
Traceback (most recent call last):
File "/Users/lw-mfiorentini/.virtualenvs/lw_em7_annotate/lib/python2.7/site-packages/kappa/event_source/sns.py", line 94, in remove
StatementId=function.name+'_'+self.context.environment)
AttributeError: 'PseudoContext' object has no attribute 'environment'
Removed event service.handler.
ERROR:Error adding lambdaInvoke permission to SNS event source
Traceback (most recent call last):
File "/Users/lw-mfiorentini/.virtualenvs/lw_em7_annotate/lib/python2.7/site-packages/kappa/event_source/sns.py", line 61, in add
StatementId=function.name+'
'+self._context.environment,
AttributeError: 'PseudoContext' object has no attribute 'environment'
Created * event schedule for service.handler!
Scheduled em7anno-zap-prod-zappa-keep-warm-handler.keep_warm_callback!

Yes, using virtual env

Expected Behavior

It should not throw this error. It does look like it deployed OK , still working on seeing what actually failed. Since this

Actual Behavior

Possible Fix

Steps to Reproduce

Your Environment

  • Zappa version used: 0.3.7.0
  • Operating System and Python version: OSX10.12.3 - Python 2.7.12
  • Your zappa_settings.py:

{
"prod": {
"app_function": "service.handler",
"s3_bucket": "zappa-f9ukazi8o",
"apigateway_enabled": false,
"project_name": "em7anno-zap",
"aws_region": "us-west-2",
"timeout_seconds": 120,
"role_name": "automation-v2-lambda-execution",
"events": [
{
"function": "service.handler", // The function to execute
"event_source": {
"arn": "arn:aws:sns:us-west-2:475806025084:lw-em7tovictorops-lambda", // The ARN of this event source
"events": [
"*" // The specific event to execute in response to.
]
}
}
]
}
}

@Miserlou
Copy link
Owner

Hm, this comes from replacing Kappa with a new version. There was an S3-specific hack that was removed, its possible we still need it for S3.

Does this get fixed if you install kappa==0.6.0 ?

@MrMitch17
Copy link
Author

It looks like I'm on 0.6.0 according to my requirements. txt.

appdirs==1.4.0
argcomplete==1.8.2
base58==0.2.4
boto3==1.4.4
botocore==1.5.8
click==6.7
docutils==0.13.1
durationpy==0.3
futures==3.0.5
hjson==2.0.2
jmespath==0.9.1
kappa==0.6.0
lambda-packages==0.13.0
packaging==16.8
placebo==0.8.1
pyparsing==2.1.10
python-dateutil==2.6.0
python-slugify==1.2.1
PyYAML==3.12
requests==2.13.0
s3transfer==0.1.10
six==1.10.0
toml==0.9.2
tqdm==4.11.2
troposphere==1.9.2
Unidecode==0.4.20
Werkzeug==0.11.15
wsgi-request-logger==0.4.6
zappa==0.35.2

@Miserlou
Copy link
Owner

That's interesting, can you try upgrading to 0.7.0?

@MrMitch17
Copy link
Author

Mmy mistake. requirements.txt is listing 0.6.0 but the env has 0.7.0 actually installed. (maybe from the upgrade) I ran pip install -I kappa==0.6.0 and I do not get the error now.

@Miserlou
Copy link
Owner

Okay, the confusing here is that that this guy says the exact opposite thing:

#681

So - which is the problem?

@MrMitch17
Copy link
Author

MrMitch17 commented Feb 22, 2017

So Strange.

Here is my pip freeze (still have the console open) from when it was throwing the error.

╰─$ pip freeze appdirs==1.4.0 argcomplete==1.8.2 base58==0.2.4 boto3==1.4.4 botocore==1.5.14 click==6.7 docutils==0.13.1 durationpy==0.3 futures==3.0.5 hjson==2.0.2 jmespath==0.9.1 kappa==0.7.0 lambda-packages==0.14.2 packaging==16.8 placebo==0.8.1 pyparsing==2.1.10 python-dateutil==2.6.0 python-slugify==1.2.1 PyYAML==3.12 requests==2.13.0 s3transfer==0.1.10 six==1.10.0 toml==0.9.2 tqdm==4.11.2 troposphere==1.9.2 Unidecode==0.4.20 Werkzeug==0.11.15 wsgi-request-logger==0.4.6 zappa==0.37.0

As a test, upgraded back to 0.7 from 0.6 and now it fails again. Maybe ask #681 for the output of their pip freeze

`╰─$ pip install -I kappa==0.7.0
Collecting kappa==0.7.0
Using cached kappa-0.7.0-py2-none-any.whl
Collecting boto3>=1.2.3 (from kappa==0.7.0)
Using cached boto3-1.4.4-py2.py3-none-any.whl
Collecting PyYAML>=3.11 (from kappa==0.7.0)
Collecting placebo>=0.8.1 (from kappa==0.7.0)
Collecting click>=5.1 (from kappa==0.7.0)
Using cached click-6.7-py2.py3-none-any.whl
Collecting botocore<1.6.0,>=1.5.0 (from boto3>=1.2.3->kappa==0.7.0)
Downloading botocore-1.5.15-py2.py3-none-any.whl (3.3MB)
100% |████████████████████████████████| 3.3MB 352kB/s
Collecting jmespath<1.0.0,>=0.7.1 (from boto3>=1.2.3->kappa==0.7.0)
Using cached jmespath-0.9.1-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3>=1.2.3->kappa==0.7.0)
Using cached s3transfer-0.1.10-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.6.0,>=1.5.0->boto3>=1.2.3->kappa==0.7.0)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting docutils>=0.10 (from botocore<1.6.0,>=1.5.0->boto3>=1.2.3->kappa==0.7.0)
Using cached docutils-0.13.1-py2-none-any.whl
Collecting futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" (from s3transfer<0.2.0,>=0.1.10->boto3>=1.2.3->kappa==0.7.0)
Using cached futures-3.0.5-py2-none-any.whl
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.6.0,>=1.5.0->boto3>=1.2.3->kappa==0.7.0)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, jmespath, docutils, botocore, futures, s3transfer, boto3, PyYAML, placebo, click, kappa
Successfully installed PyYAML-3.12 boto3-1.4.4 botocore-1.5.15 click-6.7 docutils-0.13.1 futures-3.0.5 jmespath-0.9.1 kappa-0.7.0 placebo-0.8.1 python-dateutil-2.6.0 s3transfer-0.1.10 six-1.10.0

╰─$ zappa update
(botocore 1.5.15 (/Users/lw-mfiorentini/.virtualenvs/lw_em7_annotate/lib/python2.7/site-packages), Requirement.parse('botocore==1.5.14'), set([u'zappa']))
Calling update for environment prod..
Downloading and installing dependencies..
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 32/32 [00:02<00:00, 12.73pkg/s]
Packaging project as zip..
Uploading em7anno-zap-prod-1487774009.zip (2.6MiB)..
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 2.76M/2.76M [00:01<00:00, 788KB/s]
Updating Lambda function code..
Updating Lambda function configuration..
Scheduling..
Unscheduled em7anno-zap-prod-zappa-keep-warm-handler.keep_warm_callback.
ERROR:Unable to remove lambda execute permission to SNS event source
Traceback (most recent call last):
File "/Users/lw-mfiorentini/.virtualenvs/lw_em7_annotate/lib/python2.7/site-packages/kappa/event_source/sns.py", line 94, in remove
StatementId=function.name+'_'+self.context.environment)
AttributeError: 'PseudoContext' object has no attribute 'environment'
Removed event service.handler.
ERROR:Error adding lambdaInvoke permission to SNS event source
Traceback (most recent call last):
File "/Users/lw-mfiorentini/.virtualenvs/lw_em7_annotate/lib/python2.7/site-packages/kappa/event_source/sns.py", line 61, in add
StatementId=function.name+'
'+self._context.environment,
AttributeError: 'PseudoContext' object has no attribute 'environment'
Created * event schedule for service.handler!
Scheduled em7anno-zap-prod-zappa-keep-warm-handler.keep_warm_callback!
Your updated Zappa deployment is live!
`

@d3ming
Copy link

d3ming commented Feb 23, 2017

I'm also getting this error since upgrading, forcing kappa to be at 0.6.0 fixed it

@Miserlou
Copy link
Owner

Miserlou commented Mar 1, 2017

Possibly fixed in 0.37.2, let me know if not and I'll reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants