Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Account Linking] Error 500 Post Account Linking Due To original_author_id BigInt Size Limitation #31427

Closed
Sumit189 opened this issue Jun 19, 2024 · 1 comment · Fixed by #31428
Labels
Milestone

Comments

@Sumit189
Copy link
Contributor

Description

Error: UserLinkAccount, pq: value is out of range for type bigint
When using Google OAuth, the UserID returned can be quite large, such as 1108672xxx5299468800. This value exceeds the limit of BigInt, leading to a 500 server error when processing it in the UpdateMigrationsByType function. This issue primarily arises from the following code snippet:

Where("repo_id IN (SELECT id FROM repository WHERE original_service_type = ?)", gitServiceType).
    And("original_author_id = ?", originalAuthorID)

To resolve this, the column must be updated from BigInt to numeric. Here are the SQL commands to achieve this:

ALTER TABLE issue ALTER COLUMN original_author_id TYPE NUMERIC USING original_author_id::NUMERIC;
ALTER TABLE comment ALTER COLUMN original_author_id TYPE NUMERIC USING original_author_id::NUMERIC;
ALTER TABLE release ALTER COLUMN original_author_id TYPE NUMERIC USING original_author_id::NUMERIC;
ALTER TABLE reaction ALTER COLUMN original_author_id TYPE NUMERIC USING original_author_id::NUMERIC;
ALTER TABLE review ALTER COLUMN original_author_id TYPE NUMERIC USING original_author_id::NUMERIC;

Gitea Version

v1.22

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

2.39.3

Screenshots

No response

Git Version

No response

Operating System

Ubuntu

How are you running Gitea?

Built using source

Database

PostgreSQL

@Sumit189
Copy link
Contributor Author

Sumit189 commented Jun 19, 2024

PR for the same:
#31428

@wxiaoguang wxiaoguang added this to the 1.22.1 milestone Jun 20, 2024
@wxiaoguang wxiaoguang linked a pull request Jun 20, 2024 that will close this issue
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jun 20, 2024
DennisRasey pushed a commit to DennisRasey/forgejo that referenced this issue Jun 25, 2024
Fix go-gitea/gitea#31427

(cherry picked from commit 17b3a38577d6e1d50ba5565ca3b1f2f57a04bf32)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants