gitea: Azure AD/Oauth2 - Link External Account operation fails due to MS SQL database error.
Description
When attempting to Link an external account as shown in the screenshot below (1st screenshot), I’m getting a HTTP 500 error (2nd screenshot). Upon looking at the logs, I found the following:
May 23 23:04:22 gitea gitea[1975042]: 2023/05/23 23:04:22 ...rs/web/auth/oauth.go:929:SignInOAuthCallback() [E] [646d4676-2] UserLinkAccount: mssql: String or binary data would be truncated.
Edit/Update: I tested the exact same setup with a MySQL and SQLite database, and it worked as expected. The issue has been narrowed down to some configuration issue when Gitea is backed by a MS SQL database.
Gitea Version
1.19.3
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
1st Screenshot
2nd Screenshot
Git Version
2.40.0
Operating System
Ubuntu 20.04.6 LTS
How are you running Gitea?
Gitea is ran as a service per the docs:
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=5s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
# If using unix socket: Tells Systemd to create /run/gitea folder to home gitea.sock
# Manual cration would vanish after reboot.
#RuntimeDirectory=gitea
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini -p 3000
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
# If you want to bind Gitea to a port below 1024, uncomment
# the two values below, or use socket activation to pass Gitea its ports as above
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
###
[Install]
WantedBy=multi-user.target
Database
MSSQL
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 19 (9 by maintainers)
@abjoseph Thanks for your bug report. It should be caused by the failure of migration. When you encounter similar problems, you can manually set the data type to
nvarchar(MAX). And we will try to add a newgitea doctorcommand to fix this datatype issue.