Confused about Mongodb and Postgresql credential

I am working on a old unity3d project given to me 4 years back. front and backend server required to run the game. Frontend needs Postgres Database and backend needs both Mongodb and Postgresql I was able to config all files to Python 3.9 from 2.7 and run both server. I am able to login to postgresql and mongodb. Config database connections and everything is working. When trying to login in game I get following error:

root@vps-99083:/home/Latestfiles/frontend_server# Database exception while getting session: TypeError('Secret key missing for non-string Cookie.',); ignored.
auth for user test1 with hash 098f6bcd4621d373cade4e832627b4f6 (got 098f6bcd4621d373cade4e832627b4f6)
test1 authenticating with client version 0.3.0.4...
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 1729, in wrapper
    rv = callback(*a, **ka)
  File "/usr/local/lib/python3.6/dist-packages/bottle_sqlalchemy.py", line 155, in wrapper
    rv = callback(*args, **kwargs)
  File "/home/Latestfiles/frontend_server/sessions.py", line 72, in wrapper
    return func(sess, user, *a, **k)
  File "/home/Latestfiles/frontend_server/metrics.py", line 24, in wrapper
    d = func( *a, **k )
  File "frontend.py", line 943, in login
    d = finalizeLogin( db, session, user, clientversion, clientplatform, screenName=user.username)
  File "frontend.py", line 442, in finalizeLogin
    session.user_id = user.id
AttributeError: 'NoneType' object has no attribute 'user_id'
108.14.69.202 - - [2021-06-22 19:03:11] "POST /login HTTP/1.1" 500 885 0.603911

The finalizeLogin as following. Is it related to coding or my configuration for postgresql and mongodb.

def finalizeLogin( db, session, user, clientversion, clientplatform, screenName = None ):
 #       print("Authentication OK user=" + str(user) + " sessuser=" + str(sessions.getUserById(user.id)))

        session.user_id = user.id
        user.is_online = True
        sessions.setUserById(user.id, UserState.UserState(user.username, db))
        user = sessions.getUserById(user.id)
        user.login(clientversion, clientplatform)

        if screenName is not None:
            user.screenname = screenName

        discoveryEngine.endMatchmaking( user )
        discoveryEngine.removeWithUsername( user.username )

        if not messageCenter.userLogin(user.username, user.screenname, user.id ):
            # insurance here
            messageCenter.userLogout(user.username)
            messageCenter.userLogin(user.username, user.screenname, user.id)

        messageCenter.userJoinChannel(user.username, "General")

        db.commit()

        d = {}
        d["username"] = user.screenname
        d["screenname"] = user.screenname
        d["clantag"] = user.clantag
        d["is_admin"] = True if user.account_type == 9 else False

        d["ping_delay"] = CLIENT_PING_DELAY
        d["message_delay"] = CLIENT_MESSAGE_DELAY
        d["friend_delay"] = CLIENT_FRIEND_STATUS_DELAY

        clear_matchreqs_for_user(db, user)

My pg_hba.conf:

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5
host    all             all             all                     md5
local    postgres       postgres        peer


Read more here: https://stackoverflow.com/questions/68092845/confused-about-mongodb-and-postgresql-credential

Content Attribution

This content was originally published by zille at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: