-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
"module initialization error" message for barebones flask app #159
Comments
@mgalvey It looks like you don't have zappa installed in your virtualenvironment. That is a current hiccup that can be hard to diagnose (since you probably have zappa installed OUTSIDE the environment). This happens because zappa includes a custom handler function that does all the api gateway <-> uwsgi magic and it needs to get deployed along with the rest of the lambda package, which comes straight out of the virtual env. Adding to your example, try |
Thanks @collingreen, that was definitely the problem. I had an additional issue to fix with my zappa_settings file (misunderstood what's supposed to go into the "app_function" key), but once I fixed that, I got a working deployment. It would be a handy feature for Zappa to detect that it's being invoked using a global path rather than a virtualenv one, and warn the user. At the very least an explicit blurb in the readme explaining the need to install Zappa into your target virtualenv would be helpful. It wasn't obvious to me based on what's there now, and I imagine others might experience the same issue. In any case, this issue can be closed. Thanks again for your help! |
This might be a duplicate of #107. I've been trying to get a minimal deployment (barebones generic Flask app) to work, using the example embedded into the readme, but I'm ending up with a blank response and an error message in CloudWatch when I try to hit my live API Gateway URL: "module initialization error: Attempted relative import in non-package"
I've tried to mimic the animated gif example as closely as I could, just to make sure I wasn't hitting some edge case of incompatibility with my "real" code.
I've been using a minimal install of CentOS in a VM for these tests, and I've copied the steps I took below. Am I missing something obvious here, or is there some bug in Zappa causing this to occur?
The text was updated successfully, but these errors were encountered: