Odoo Session Expired Randomly - python

i keep getting the message ''Odoo Session Expired'' randomly. I have no idea why. I restarted my local instance/server but this didn't solve the problem.

This error comes when you run multiple instances of odoo in local and browse from same browser.

Related

Python Django /w Microsoft Graphs - I keep getting value error "state missing from auth_code_flow"

Python Django /w Microsoft Graphs -
I'm following this Microsoft Tutorial for building Django apps with Microsoft Graph (using it on my existing Django webapp), and I am having an issue with authentication: https://learn.microsoft.com/en-us/graph/tutorials/python
I'm on the step 'Add Azure AD authentication' and, after implementing,
I hit the sign in button and enter credentials...and I keep getting value error "state missing from auth_code_flow".
The "callback" method is only making it to result=get_token_from_code(request) and then fails.
Here is the get_token_from_code method:
def get_token_from_code(request):
cache = load_cache(request)
auth_app = get_msal_app(cache)
# Get the flow saved in session
flow = request.session.pop('auth_flow', {})
result = auth_app.acquire_token_by_auth_code_flow(flow, request.GET)
save_cache(request, cache)
return result
What I'm trying to do is eventually access excel online from my webapp.
Any help is greatly appreciated!
I just had this issue and resolved it. It is one of these two things:
You are starting out at 127.0.0.1:8000 and then when you're redirected you're at localhost:8000, which is a different domain. The sessions aren't remembered from one domain to the other. The solution is to start out on localhost:8000 so that the session persists across login.
Your browser is using super-strict cookie settings. Microsoft Edge appears to default to this mode on localhost and 127.0.0.1. There is a lock or shield icon in or near your address bar that lets you relax the restrictions on your cookie settings.
Try one or both of these and you should succeed.
I'm a beginner coder, so i'm pretty sure im just circumventing around the error. But replacing the website URL with http://localhost:8000/# and re running it somehow got around the error. maybe that could be of some use.
If you are running on chrome, rather than running application on http://127.0.0.1:8000 run it on http://localhost:8000, because chrome isn't saving the cookies when the ip address is being used.

MySQL server has gone away: One API throws it while other doesn't

I have two flask restful API's. Both are working fine.
API1 is only for reading the database, API2 deals with update/insert. Both access the same database.
API1 stops working and I have to restart it every morning. Error is - MySQL server is gone away.
API2 always work doesn't give any error.
Earlier, I thought wait_timeout (default 8 hours) could be the reason that API1 throws that error. But, why does API2 work then?
(I use a class for database operations, and I have connect string in its init method. Also, I do not close any of the database connection. I'll very soon edit to corect it, just giving the info here to know the exact reason for that error)
Question - Why does API2 never give the same error?

Error: not found - missing when clicking on DB (Couchdb)

I am trying to view a Couchdb database in the browser named event_db. However, when I navigate to the following url: http://localhost:5984/_utils/database.html?event_db I get the an Error: not found missing and my url automatically redirects to http://localhost:5984/_utils/database.html?event_db/_changes.
This problem seemed to occur after I added _changes to the url and created a script checking the database for change here: couchdb-python change notifications
Has anyone ever experienced this problem? If so, how would I fix it?
My apologies I am new to Couchdb.
Thank you for your help,
Brian
Turns out I needed to clear my cache in my browser. After I did this, I was able to successfully navigate to the event_db.

500 Internal Server Error Heroku

I have a little system built for learning purposes with Flask-SQLAlchemy and deployed on Heroku(python/postgresql:
http://monkey-me.herokuapp.com/
https://github.com/coolcatDev/monkey-me
My app works fine locally and I have unit tested its functionality and use cases through 14 successfully passed tests.
When I deploy everything seems to go perfectly. Its deployed, I define environment variable APP_SETTINGS>>>config.BaseConfig, I run the db_create.py script to initialize the db. I create some users:
username-userpassword:
Alex-passwordAlex
Jack-passwordJack
Sara-passwordSara
But one thing is missing...I go to the users page from the main navigation bar and I get a 5oo internal server error saying:
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
My app code on app.py has debug mode on:
if __name__ == '__main__':
app.run(debug=True)
But no further error is displayed.
Notice that if I access the system on heroku and I am logged out, if I go to Users I am as I should redirected to the login page so thats how far I have gone with the debug...
If I set the environment variable LAUNCHY_DEBUG on heroku to either true or false everything goes crazy and new problems appear...like I cant delete a user, the profile images wont load....
If I remove the LAUNCHY_DEBUG var from heroku the new problems(images wont load, can't remove user..) persist among the original 500 error of the users page.
Thanks in advance for any suggestion with the debugging
Use the following to get more feedback written in logs:
import logging
app.logger.addHandler(logging.StreamHandler(sys.stdout))
app.logger.setLevel(logging.ERROR)
That reveals the problem:
ProgrammingError: (ProgrammingError) column "user_bf.id" must appear in the GROUP BY clause or be used in an aggregate function
Modify query:
userList = (
users.query
.add_column(db.func.count(friendships.user_id).label("total"))
.add_column(user_bf.id.label("best_friend"))
.add_column(user_bf.userName.label("best_friend_name"))
.outerjoin(friendships, users.id == friendships.user_id)
.outerjoin(user_bf, users.best_friend)
.group_by(users.id, user_bf.id)
.order_by(test)
.paginate(page, 6, False)
)
Regarding the images disappearing:
Any file written on a filesystem hosted on heroku will be deleted on dynos end of lifecycle.

Heroku warnings in logs using django-celery

I am trying to deploy my first app with heroku, and I keep running into issues. Essentially, now whenever I try to open my app with heroku open, I get the "Application Error" page telling me to check my logs. I successfully was able to get through the tutorial, but now following the same steps with my own project, I haven't had any luck. As far as I can tell from the logs, the relevant warnings I am getting are:
WARNING/MainProcess] celery#ce7e5946-3bc3-4622-856f-863b49f442d4 ready
WARNING/Beat] Reset: Account for new version field
WARNING/Beat] Reset: Account for utc_enabled field
WARNING/Beat] Reset: Account for new tz field
The last three all seem to stem from the PersistentScheluler class within celery/beat.py, but I don't understand why. I have no idea about the first warning (or why that is even a warning). Any insight? Thanks in advance for the help.
have you tried to set DEBUG to True in Django settings ?
that should give you enough information about the error to fix it.

Categories

Resources