Closed fxjordan closed 2 years ago
Although, linking a Twitter account multiple times already worked, there seems to be a problem (at least when another user tries to link an account):
{ "code": 500, "msg": "SQL [insert into \"public\".\"linked_twitter_account\" (\"id\", \"twitter_username\", \"linked_by_user_id\", \"access_token\", \"refresh_token\", \"creation_date\", \"last_updated_date\", \"expiration_date\") values (?, ?, ?, ?, ?, cast(? as timestamp(6) with time zone), cast(? as timestamp(6) with time zone), cast(? as timestamp(6) with time zone)) returning \"public\".\"linked_twitter_account\".\"id\", \"public\".\"linked_twitter_account\".\"twitter_username\", \"public\".\"linked_twitter_account\".\"linked_by_user_id\", \"public\".\"linked_twitter_account\".\"access_token\", \"public\".\"linked_twitter_account\".\"refresh_token\", \"public\".\"linked_twitter_account\".\"creation_date\", \"public\".\"linked_twitter_account\".\"last_updated_date\", \"public\".\"linked_twitter_account\".\"expiration_date\"]; ERROR: duplicate key value violates unique constraint \"linked_twitter_acc_pkey\"\n Detail: Key (id)=(0) already exists.SQL [insert into \"public\".\"linked_twitter_account\" (\"id\", \"twitter_username\", \"linked_by_user_id\", \"access_token\", \"refresh_token\", \"creation_date\", \"last_updated_date\", \"expiration_date\") values (?, ?, ?, ?, ?, cast(? as timestamp(6) with time zone), cast(? as timestamp(6) with time zone), cast(? as timestamp(6) with time zone)) returning \"public\".\"linked_twitter_account\".\"id\", \"public\".\"linked_twitter_account\".\"twitter_username\", \"public\".\"linked_twitter_account\".\"linked_by_user_id\", \"public\".\"linked_twitter_account\".\"access_token\", \"public\".\"linked_twitter_account\".\"refresh_token\", \"public\".\"linked_twitter_account\".\"creation_date\", \"public\".\"linked_twitter_account\".\"last_updated_date\", \"public\".\"linked_twitter_account\".\"expiration_date\"]; ERROR: duplicate key value violates unique constraint \"linked_twitter_acc_pkey\"\n Detail: Key (id)=(0) already exists.", "stacktrace": [ "de.rwth.dbis.acis.bazaar.service.exception.BazaarException: SQL [insert into \"public\".\"linked_twitter_account\" (\"id\", \"twitter_username\", \"linked_by_user_id\", \"access_token\", \"refresh_token\", \"creation_date\", \"last_updated_date\", \"expiration_date\") values (?, ?, ?, ?, ?, cast(? as timestamp(6) with time zone), cast(? as timestamp(6) with time zone), cast(? as timestamp(6) with time zone)) returning \"public\".\"linked_twitter_account\".\"id\", \"public\".\"linked_twitter_account\".\"twitter_username\", \"public\".\"linked_twitter_account\".\"linked_by_user_id\", \"public\".\"linked_twitter_account\".\"access_token\", \"public\".\"linked_twitter_account\".\"refresh_token\", \"public\".\"linked_twitter_account\".\"creation_date\", \"public\".\"linked_twitter_account\".\"last_updated_date\", \"public\".\"linked_twitter_account\".\"expiration_date\"]; ERROR: duplicate key value violates unique constraint \"linked_twitter_acc_pkey\"\n Detail: Key (id)=(0) already exists.SQL [insert into \"public\".\"linked_twitter_account\" (\"id\", \"twitter_username\", \"linked_by_user_id\", \"access_token\", \"refresh_token\", \"creation_date\", \"last_updated_date\", \"expiration_date\") values (?, ?, ?, ?, ?, cast(? as timestamp(6) with time zone), cast(? as timestamp(6) with time zone), cast(? as timestamp(6) with time zone)) returning \"public\".\"linked_twitter_account\".\"id\", \"public\".\"linked_twitter_account\".\"twitter_username\", \"public\".\"linked_twitter_account\".\"linked_by_user_id\", \"public\".\"linked_twitter_account\".\"access_token\", \"public\".\"linked_twitter_account\".\"refresh_token\", \"public\".\"linked_twitter_account\".\"creation_date\", \"public\".\"linked_twitter_account\".\"last_updated_date\", \"public\".\"linked_twitter_account\".\"expiration_date\"]; ERROR: duplicate key value violates unique constraint \"linked_twitter_acc_pkey\"\n Detail: Key (id)=(0) already exists." ] }
The error is also reproducible on localhost when linking with the same account twice
The old linked account was not deleted (caused by #145)
fixed by fixing #145
Although, linking a Twitter account multiple times already worked, there seems to be a problem (at least when another user tries to link an account):