Adding New Users to Pontoon

I have managed to set-up a local Pontoon instance after deploying with heroku. I’m now having issues adding new users to my third party pontoon instance via the admin Django UI. I simply get a message " Oops! Something is wrong. We’re going to fix it soon." Any ideas to go around this? When I check the logs with ‘heroku logs --app=my-app’ I see status 500, and says DETAIL: Key (user_id)=(11) already exists. Any help please? Thanks

Hey @jmukiibi
I can’t reproduce the error on my local instance. Could you provide more details like:

  • Which authentication provider your instance use?
  • Did you modify the code on your local instance?
  • The error mentions that user id is 11 -> How did you create the first 10 users?

@jotes I haven’t created any user yet. The only user I have is the admin. I created this user the moment I deployed Pontoon on Heroku. In total I have 5 users and the other 4 were already there by default. You can take a look at the screen shot. I just can’t figure out the cause. I just thought it is an issue that maybe needs to be fixed.

@jotes

The other errors logged are: django.db.utils.IntegrityError: duplicate key value violates unique constraint “base_userprofile_user_id_key”
2020-10-11T21:35:44.450336+00:00 app[web.1]: DETAIL: Key (user_id)=(12) already exists.
More logs here:

@jmukiibi
I had deployed a new instance of Pontoon on Heroku and successfully reproduced the issue.
I don’t know what’s the root cause, but I’m planning to take a look and file a bug.

2 Likes

@jotes Thanks a lot it. I will be looking forward to a solution. In the meantime are there any kind of alternatives for adding users other than through the Django admin platform? Thanks

@jmukiibi

You can track the progress on this issue here: https://bugzilla.mozilla.org/show_bug.cgi?id=1671295

To answer your question:

It’s possible to add a user via the manage.py shell_plus command.
It gives you access to a special version of a Python interpreter that has access to the database.
After you run the interpreter on Heroku, you can type:

User.objects.create_superuser(username='user', email='user.example.com', password='xxx')

This line creates a new super user.

1 Like

After saving one user, it now works well. Interesting!!

@jmukiibi
Could you download the latest version of the main branch and check if the problem still exists?