Skip to content

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

Closed
@Sumit189

Description

@Sumit189

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions