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
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/", line 862, in _handle
  File "/usr/local/lib/python3.6/dist-packages/", line 1729, in wrapper
    rv = callback(*a, **ka)
  File "/usr/local/lib/python3.6/dist-packages/", line 155, in wrapper
    rv = callback(*args, **kwargs)
  File "/home/Latestfiles/frontend_server/", line 72, in wrapper
    return func(sess, user, *a, **k)
  File "/home/Latestfiles/frontend_server/", line 24, in wrapper
    d = func( *a, **k )
  File "", line 943, in login
    d = finalizeLogin( db, session, user, clientversion, clientplatform, screenName=user.username)
  File "", line 442, in finalizeLogin
    session.user_id =
AttributeError: 'NoneType' object has no attribute 'user_id' - - [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(

        session.user_id =
        user.is_online = True
        sessions.setUserById(, UserState.UserState(user.username, db))
        user = sessions.getUserById(
        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, ):
            # insurance here
            messageCenter.userLogin(user.username, user.screenname,

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


        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               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               md5
host    replication     all             ::1/128                 md5
host    all             all             all                     md5
local    postgres       postgres        peer

Read more here:

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: