auth.SignInPost 500 Internal Server Error #11579

Closed
opened 2025-11-02 09:41:36 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @SchisandraX on GitHub (Sep 1, 2023).

Description

When I log in with the admin account, there are 500 errors on the web interface

error log

2023/09/01 06:11:22 ...eb/routing/logger.go:102:func1() [I] router: completed POST /user/login for 10.42.1.142:55664, 500 Internal Server Error in 131.2ms @ auth/auth.go:170(auth.SignInPost)

Gitea Version

1.20.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

k8s

Database

None

Originally created by @SchisandraX on GitHub (Sep 1, 2023). ### Description When I log in with the admin account, there are 500 errors on the web interface #### error log `2023/09/01 06:11:22 ...eb/routing/logger.go:102:func1() [I] router: completed POST /user/login for 10.42.1.142:55664, 500 Internal Server Error in 131.2ms @ auth/auth.go:170(auth.SignInPost)` ### Gitea Version 1.20.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? k8s ### Database None
GiteaMirror added the type/question label 2025-11-02 09:41:36 -06:00
Author
Owner

@lunny commented on GitHub (Sep 1, 2023):

Could you paste more logs?

@lunny commented on GitHub (Sep 1, 2023): Could you paste more logs?
Author
Owner

@SchisandraX commented on GitHub (Sep 1, 2023):

Could you paste more logs?

all of gitea container logs

Defaulted container "gitea" out of: gitea, init-directories (init), init-app-ini (init), configure-gitea (init)
Generating /data/ssh/ssh_host_ed25519_key...
Generating /data/ssh/ssh_host_rsa_key...
Generating /data/ssh/ssh_host_ecdsa_key...
Server listening on :: port 2222.
Server listening on 0.0.0.0 port 2222.
2023/09/01 06:10:13 cmd/web.go:223:runWeb() [I] Starting Gitea on PID: 19
2023/09/01 06:10:13 cmd/web.go:148:serveInstalled() [I] Gitea version: 1.20.3 built with GNU Make 4.4.1, go1.20.7 : bindata, timetzdata, sqlite, sqlite_unlock_notify
2023/09/01 06:10:13 cmd/web.go:149:serveInstalled() [I] App path: /usr/local/bin/gitea
2023/09/01 06:10:13 cmd/web.go:150:serveInstalled() [I] Work path: /data
2023/09/01 06:10:13 cmd/web.go:151:serveInstalled() [I] Custom path: /data/gitea
2023/09/01 06:10:13 cmd/web.go:152:serveInstalled() [I] Config file: /data/gitea/conf/app.ini
2023/09/01 06:10:13 cmd/web.go:153:serveInstalled() [I] Run mode: prod
2023/09/01 06:10:13 cmd/web.go:154:serveInstalled() [I] Prepare to run web server
2023/09/01 06:10:13 routers/init.go:112:InitWebInstalled() [I] Git version: 2.40.1, Wire Protocol Version 2 Enabled (home: /data/home)
2023/09/01 06:10:13 ...les/setting/cache.go:75:loadCacheFrom() [I] Cache Service Enabled
2023/09/01 06:10:13 ...les/setting/cache.go:90:loadCacheFrom() [I] Last Commit Cache Service Enabled
2023/09/01 06:10:13 ...s/setting/session.go:74:loadSessionFrom() [I] Session Service Enabled
2023/09/01 06:10:13 ...es/setting/mailer.go:203:loadMailerFrom() [W] connecting over insecure SMTP protocol to non-local address is not recommended
2023/09/01 06:10:13 ...es/setting/mailer.go:237:loadMailerFrom() [I] Mail Service Enabled
2023/09/01 06:10:13 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/attachments
2023/09/01 06:10:13 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/avatars
2023/09/01 06:10:13 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/repo-avatars
2023/09/01 06:10:13 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/repo-archive
2023/09/01 06:10:13 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/packages
2023/09/01 06:10:13 routers/init.go:130:InitWebInstalled() [I] SQLite3 support is enabled
2023/09/01 06:10:13 routers/common/db.go:21:InitDBEngine() [I] Beginning ORM engine initialization.
2023/09/01 06:10:13 routers/common/db.go:28:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2023/09/01 06:10:13 cmd/web.go:175:serveInstalled() [I] PING DATABASE postgres
2023/09/01 06:10:14 cmd/web.go:175:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2023/09/01 06:10:14 cmd/web.go:175:serveInstalled() [W] Table oauth2_application Column confidential_client db default is true, struct default is TRUE
2023/09/01 06:10:14 cmd/web.go:175:serveInstalled() [W] Table user Column max_repo_creation db default is '-1', struct default is -1
2023/09/01 06:10:15 routers/init.go:136:InitWebInstalled() [I] ORM engine initialization successful!
2023/09/01 06:10:16 ...er/issues/indexer.go:156:func2() [I] PID 19: Initializing Issue Indexer: db
2023/09/01 06:10:16 ...er/issues/indexer.go:246:func3() [I] Issue Indexer Initialization took 242.077µs
2023/09/01 06:10:16 ...xer/stats/indexer.go:38:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
2023/09/01 06:10:16 routers/init.go:81:syncAppConfForGit() [I] AppPath changed from '' to '/usr/local/bin/gitea'
2023/09/01 06:10:16 routers/init.go:86:syncAppConfForGit() [I] CustomConf changed from '' to '/data/gitea/conf/app.ini'
2023/09/01 06:10:16 routers/init.go:92:syncAppConfForGit() [I] re-sync repository hooks ...
2023/09/01 06:10:16 routers/init.go:95:syncAppConfForGit() [I] re-write ssh public keys ...
2023/09/01 06:10:17 ...rvices/cron/tasks.go:117:func2() [E] CreateNotice: pq: cannot execute INSERT in a read-only transaction
2023/09/01 06:10:17 ...dels/git/branches.go:106:RemoveOldDeletedBranches() [E] DeletedBranchesCleanup: pq: cannot execute DELETE in a read-only transaction
2023/09/01 06:10:17 cmd/web.go:285:listen() [I] Listen: http://0.0.0.0:3000
2023/09/01 06:10:17 cmd/web.go:289:listen() [I] AppURL(ROOT_URL): https://wukong.tdology.com/
2023/09/01 06:10:17 ...s/graceful/server.go:62:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 19
2023/09/01 06:11:09 ...eb/routing/logger.go:102:func1() [I] router: completed GET / for 10.42.1.142:55664, 200 OK in 15.5ms @ web/home.go:32(web.Home)
2023/09/01 06:11:12 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login?redirect_to=%2f for 10.42.1.142:55678, 200 OK in 28.0ms @ auth/auth.go:141(auth.SignIn)
2023/09/01 06:11:22 ...ers/web/auth/auth.go:321:handleSignInFull() [E] UpdateUserCols Language: Error updating user language [user: 1, locale: zh-CN]
2023/09/01 06:11:22 ...eb/routing/logger.go:102:func1() [I] router: completed POST /user/login for 10.42.1.142:55664, 500 Internal Server Error in 131.2ms @ auth/auth.go:170(auth.SignInPost)
@SchisandraX commented on GitHub (Sep 1, 2023): > Could you paste more logs? ## all of gitea container logs ``` Defaulted container "gitea" out of: gitea, init-directories (init), init-app-ini (init), configure-gitea (init) Generating /data/ssh/ssh_host_ed25519_key... Generating /data/ssh/ssh_host_rsa_key... Generating /data/ssh/ssh_host_ecdsa_key... Server listening on :: port 2222. Server listening on 0.0.0.0 port 2222. 2023/09/01 06:10:13 cmd/web.go:223:runWeb() [I] Starting Gitea on PID: 19 2023/09/01 06:10:13 cmd/web.go:148:serveInstalled() [I] Gitea version: 1.20.3 built with GNU Make 4.4.1, go1.20.7 : bindata, timetzdata, sqlite, sqlite_unlock_notify 2023/09/01 06:10:13 cmd/web.go:149:serveInstalled() [I] App path: /usr/local/bin/gitea 2023/09/01 06:10:13 cmd/web.go:150:serveInstalled() [I] Work path: /data 2023/09/01 06:10:13 cmd/web.go:151:serveInstalled() [I] Custom path: /data/gitea 2023/09/01 06:10:13 cmd/web.go:152:serveInstalled() [I] Config file: /data/gitea/conf/app.ini 2023/09/01 06:10:13 cmd/web.go:153:serveInstalled() [I] Run mode: prod 2023/09/01 06:10:13 cmd/web.go:154:serveInstalled() [I] Prepare to run web server 2023/09/01 06:10:13 routers/init.go:112:InitWebInstalled() [I] Git version: 2.40.1, Wire Protocol Version 2 Enabled (home: /data/home) 2023/09/01 06:10:13 ...les/setting/cache.go:75:loadCacheFrom() [I] Cache Service Enabled 2023/09/01 06:10:13 ...les/setting/cache.go:90:loadCacheFrom() [I] Last Commit Cache Service Enabled 2023/09/01 06:10:13 ...s/setting/session.go:74:loadSessionFrom() [I] Session Service Enabled 2023/09/01 06:10:13 ...es/setting/mailer.go:203:loadMailerFrom() [W] connecting over insecure SMTP protocol to non-local address is not recommended 2023/09/01 06:10:13 ...es/setting/mailer.go:237:loadMailerFrom() [I] Mail Service Enabled 2023/09/01 06:10:13 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local 2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/attachments 2023/09/01 06:10:13 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local 2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/avatars 2023/09/01 06:10:13 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local 2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/repo-avatars 2023/09/01 06:10:13 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local 2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/repo-archive 2023/09/01 06:10:13 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local 2023/09/01 06:10:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/packages 2023/09/01 06:10:13 routers/init.go:130:InitWebInstalled() [I] SQLite3 support is enabled 2023/09/01 06:10:13 routers/common/db.go:21:InitDBEngine() [I] Beginning ORM engine initialization. 2023/09/01 06:10:13 routers/common/db.go:28:InitDBEngine() [I] ORM engine initialization attempt #1/10... 2023/09/01 06:10:13 cmd/web.go:175:serveInstalled() [I] PING DATABASE postgres 2023/09/01 06:10:14 cmd/web.go:175:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1 2023/09/01 06:10:14 cmd/web.go:175:serveInstalled() [W] Table oauth2_application Column confidential_client db default is true, struct default is TRUE 2023/09/01 06:10:14 cmd/web.go:175:serveInstalled() [W] Table user Column max_repo_creation db default is '-1', struct default is -1 2023/09/01 06:10:15 routers/init.go:136:InitWebInstalled() [I] ORM engine initialization successful! 2023/09/01 06:10:16 ...er/issues/indexer.go:156:func2() [I] PID 19: Initializing Issue Indexer: db 2023/09/01 06:10:16 ...er/issues/indexer.go:246:func3() [I] Issue Indexer Initialization took 242.077µs 2023/09/01 06:10:16 ...xer/stats/indexer.go:38:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories 2023/09/01 06:10:16 routers/init.go:81:syncAppConfForGit() [I] AppPath changed from '' to '/usr/local/bin/gitea' 2023/09/01 06:10:16 routers/init.go:86:syncAppConfForGit() [I] CustomConf changed from '' to '/data/gitea/conf/app.ini' 2023/09/01 06:10:16 routers/init.go:92:syncAppConfForGit() [I] re-sync repository hooks ... 2023/09/01 06:10:16 routers/init.go:95:syncAppConfForGit() [I] re-write ssh public keys ... 2023/09/01 06:10:17 ...rvices/cron/tasks.go:117:func2() [E] CreateNotice: pq: cannot execute INSERT in a read-only transaction 2023/09/01 06:10:17 ...dels/git/branches.go:106:RemoveOldDeletedBranches() [E] DeletedBranchesCleanup: pq: cannot execute DELETE in a read-only transaction 2023/09/01 06:10:17 cmd/web.go:285:listen() [I] Listen: http://0.0.0.0:3000 2023/09/01 06:10:17 cmd/web.go:289:listen() [I] AppURL(ROOT_URL): https://wukong.tdology.com/ 2023/09/01 06:10:17 ...s/graceful/server.go:62:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 19 2023/09/01 06:11:09 ...eb/routing/logger.go:102:func1() [I] router: completed GET / for 10.42.1.142:55664, 200 OK in 15.5ms @ web/home.go:32(web.Home) 2023/09/01 06:11:12 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login?redirect_to=%2f for 10.42.1.142:55678, 200 OK in 28.0ms @ auth/auth.go:141(auth.SignIn) 2023/09/01 06:11:22 ...ers/web/auth/auth.go:321:handleSignInFull() [E] UpdateUserCols Language: Error updating user language [user: 1, locale: zh-CN] 2023/09/01 06:11:22 ...eb/routing/logger.go:102:func1() [I] router: completed POST /user/login for 10.42.1.142:55664, 500 Internal Server Error in 131.2ms @ auth/auth.go:170(auth.SignInPost) ```
Author
Owner

@puni9869 commented on GitHub (Sep 1, 2023):

2023/09/01 06:11:22 ...ers/web/auth/auth.go:321:handleSignInFull() [E] UpdateUserCols Language: Error updating user language [user: 1, locale: zh-CN]

Do you have write permission/role to database.

@puni9869 commented on GitHub (Sep 1, 2023): ``` 2023/09/01 06:11:22 ...ers/web/auth/auth.go:321:handleSignInFull() [E] UpdateUserCols Language: Error updating user language [user: 1, locale: zh-CN] ``` Do you have write permission/role to database.
Author
Owner

@SchisandraX commented on GitHub (Sep 1, 2023):

2023/09/01 06:11:22 ...ers/web/auth/auth.go:321:handleSignInFull() [E] UpdateUserCols Language: Error updating user language [user: 1, locale: zh-CN]

Do you have write permission/role to database.

i use default helm config, login with gitea_admin

database config

postgresql-ha:
  global:
    postgresql:
      database: gitea
      password: gitea
      username: gitea
  enabled: true
  postgresql:
    repmgrPassword: changeme2
    postgresPassword: changeme1
    password: changeme4
  pgpool:
    adminPassword: changeme3
  service:
    ports:
      postgresql: 5432
  primary:
    persistence:
      size: 10Gi

gitea admin user config

gitea:
  ## @param gitea.admin.username Username for the Gitea admin user
  ## @param gitea.admin.existingSecret Use an existing secret to store admin user credentials
  ## @param gitea.admin.password Password for the Gitea admin user
  ## @param gitea.admin.email Email for the Gitea admin user
  admin:
    # existingSecret: gitea-admin-secret
    existingSecret:
    username: gitea_admin
    password: r8sA8CPHD9!bt6d
    email: "gitea@local.domain"
@SchisandraX commented on GitHub (Sep 1, 2023): > ``` > 2023/09/01 06:11:22 ...ers/web/auth/auth.go:321:handleSignInFull() [E] UpdateUserCols Language: Error updating user language [user: 1, locale: zh-CN] > ``` > > Do you have write permission/role to database. i use default helm config, login with gitea_admin ## database config ``` postgresql-ha: global: postgresql: database: gitea password: gitea username: gitea enabled: true postgresql: repmgrPassword: changeme2 postgresPassword: changeme1 password: changeme4 pgpool: adminPassword: changeme3 service: ports: postgresql: 5432 primary: persistence: size: 10Gi ``` ## gitea admin user config ``` gitea: ## @param gitea.admin.username Username for the Gitea admin user ## @param gitea.admin.existingSecret Use an existing secret to store admin user credentials ## @param gitea.admin.password Password for the Gitea admin user ## @param gitea.admin.email Email for the Gitea admin user admin: # existingSecret: gitea-admin-secret existingSecret: username: gitea_admin password: r8sA8CPHD9!bt6d email: "gitea@local.domain" ```
Author
Owner

@wxiaoguang commented on GitHub (Sep 1, 2023):

I guess postgresql-ha is the problem, are you trying to write into a read-only postgresql instance?

Maybe you could ask the helmchart maintainers to help.

@wxiaoguang commented on GitHub (Sep 1, 2023): I guess `postgresql-ha` is the problem, are you trying to write into a read-only postgresql instance? Maybe you could ask the helmchart maintainers to help.
Author
Owner

@SchisandraX commented on GitHub (Sep 4, 2023):

I agree with you that I work well with postgresql

I guess postgresql-ha is the problem, are you trying to write into a read-only postgresql instance?

Maybe you could ask the helmchart maintainers to help.

@SchisandraX commented on GitHub (Sep 4, 2023): I agree with you that I work well with postgresql > I guess `postgresql-ha` is the problem, are you trying to write into a read-only postgresql instance? > > Maybe you could ask the helmchart maintainers to help.
Author
Owner

@lunny commented on GitHub (Sep 4, 2023):

I think this could be closed as it's unrelated with Gitea itself.

@lunny commented on GitHub (Sep 4, 2023): I think this could be closed as it's unrelated with Gitea itself.
Author
Owner

@SchisandraX commented on GitHub (Sep 4, 2023):

ok

@SchisandraX commented on GitHub (Sep 4, 2023): ok
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11579