superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.76k stars 322 forks source link

[bug] 500 ISE on accessing gotosocial admin. #1106

Closed monaka closed 1 year ago

monaka commented 1 year ago

Describe the bug with a clear and concise description of what the bug is.

I'm using GTS that is deployed with a Helm chart. It is used with Keycloak(OIDC). It worked fine. I could modify my profile by using https://gts.superseriousbusiness.org/admin (Admin console)

Next, I tried to enable an admin account by running ./gotosocial admin account confirm . After that, the Admin console returns the 500 error. Other users still can access the Admin console.

What's your GoToSocial Version?

0.5.2 git-c31f219

GoToSocial Arch

amd64 Docker

Browser version

Chrome Version 107.0.5304.110 (Official Build) (64-bit)

What happened?

  1. I deployed GTS by Helm chart.
  2. I connected my GTS and my Keycloak.
  3. I tooted with Pinafone.
  4. I modified my profile with the official Admin console.
  5. (above are the same as expected)
  6. I executed ./gotosocial admin account confirm --usersname {myname} --host {my GTS host} in the container.
  7. I tried to tune my host by accessing the official Admin console.
  8. My browser shows Internal Server Error.
  9. Logs by GTS are as follows.
gotosocial-d8c7554fb-xhqwt gotosocial timestamp="21/11/2022 04:30:25.013" func=router.loggingMiddleware.func1 level=ERROR latency=322.706978ms clientIP=1.75.159.181 userAgent="Mozilla/5.0 (X11; CrOS x86_64 15117.112.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36" method=GET statusCode=500 path=/auth/callback error="Error #01: already exists\n" msg="Internal Server Error: wrote 588B"

What you expected to happen?

Eneble to access the official Admin console with no error.

How to reproduce it?

100% reproduces on my instance. But I'm not sure how to reproduce in any environment.

Anything else we need to know?

No response

monaka commented 1 year ago

I got it. I must call ./gotosocial admin promote instead of ./gotosocial admin confirm. I suppose the state of my account is broken By calling confirm. I guess this issue is fixed by accessing my Postgres database..., right?

monaka commented 1 year ago

Self resolved. Steps:

  1. Deletes my account in the users table.
  2. Removes cookies in Pinafona and restart.
  3. Accesses the official Admin console.

My toots are gone. But it's not serious to me because I just started to toot today.

I hope there have some fool proof checks in the ./gotosocial admin subcommand.

tsmethurst commented 1 year ago

Thanks, indeed it's kinda weird that confirm broke the account. I'll make a separate issue for that and close this one, since your issue is resolved for now :)