Permission denied error trying to create new user by authentication request

Using Nakama 3, postgres DB, and the Unity SDK, I’m calling AuthenticateDeviceAsync() with create == true, but getting response 500: error finding user account.

Looking at server logs, I see the DB denied access.

"caller": "server/core_authenticate.go:177",
"msg": "Error looking up user by device ID.",
"error": "ERROR: permission denied for relation user_device (SQLSTATE 42501)",

I haven’t changed any permissions (that I know of!).

I’m new to postgres and backend devops in general. I would expect the DB to be in a default state where it could perform these (seemingly?) basic operations. Any suggestions appreciated!

@jasontosh You haven’t explained how you set up Postgres or Nakama, so it’s hard to give specific advice.

At a glance I’d say it’s possible you’re using different Postgres users to run the server’s schema migration and then start up the server. If this is the case then the schema’s permissions would not allow the server to use it.

Consider using docker-compose with the standard config provided in the repo if you’re looking for a simple way to get up and running.

1 Like

I am hosting it on NodeChef. I tried using the Docker Compose yml file first, but NodeChef either doesn’t support Compose, or I did it wrong, but I was able to get the plain old dockerfile working. I’ll look into that more and check all the permissions in the DB. Thanks for your time.

When you mentioned different users, it made me realize that the NodeChef system does run in the context of a user they created with the cluster, and when I gave that user superuser permission in Postgres, it all worked. :star_struck: Thanks again! I’m looking forward to building with Nakama.