Comments (1)
I realise this is a fairly old issue, but I have just made an interesting (for me) observation here. Before I get to my experience, allow me to say that you should provide a log of your pod (assuming this was deployed to Kubernetes) to determine the actual error that caused the "Error 500" reply. You could get that log by doing something like: kubectl logs -f azure-vote-front-USE_YOUR_POD_NAME_HERE
which in my case showed this:
[2020-07-28 11:26:34,930] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "./main.py", line 57, in index
vote1 = r.get(button1).decode('utf-8')
Looking at the code here: https://github.com/Azure-Samples/azure-voting-app-redis/blob/master/azure-vote/azure-vote/main.py#L57 we can assume that for some reason r.get(button1)
returns None
.
Technically, this means that there is no entry in Redis with the key button1
(which equals "Cats"
in the default configuration: https://github.com/Azure-Samples/azure-voting-app-redis/blob/master/azure-vote/azure-vote/config_file.cfg#L3)
Why would there be no entry in Redis? After all this line if not r.get(button1): r.set(button1,0)
initiallized those values with something: https://github.com/Azure-Samples/azure-voting-app-redis/blob/master/azure-vote/azure-vote/main.py#L48
Turns out - in my case - I had applied the azure-vote-all-in-one-redis.yaml
file, then made a change to the azure-vote-back
and applied the deployment again. Since I only edited the azure-vote-back
(Redis service), the front-end app (azure-vote-front
) did not re-initialize, but kept running and assuming that it had in fact already initialized those Redis keys!
Therefore, the underlying issue here is, that you should either use persistent Redis storage if you want to rely upon some pre-initialized values or you should to improve the error handling in those situation. Now I realize this is only a sample app without those considerations, but it would be a good follow up for a tutorial to explain why (and how) persistent storage is added for a database backend.
You could either restart the azure-vote-front
pod, which will automatically re-initialize those Redis values or you could manually set them yourself (for example through an interactive shell).
from azure-voting-app-redis.
Related Issues (14)
- 1
- Bitnami Redis image is deprecated from MCR
- Add support for Web App for Containers HOT 3
- App resets counters on init.
- StrictRedis() needs to be used when redis has a password HOT 1
- Base image size is unnecessarily large
- Error: driver failed programming external conn HOT 1
- Error 502 Bad Gateway when deploying into ACI HOT 3
- Error with docker compose HOT 1
- Reloading the page for voting app increases counter HOT 1
- bitnami/redis images does not support ARM based platforms
- spec.template.spec.nodeSelector[beta.kubernetes.io/os]: deprecated -- warning shown
- The system cannot find the file specified HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-voting-app-redis.