Skip to content

Data too long for column 'avatar' #620

@mortenbirkelund

Description

@mortenbirkelund

Describe the bug
It seems like the amount of data that is stored as json in the column 'avatar' of the user table, is exceeding its limits set in mysql.

2023-11-10 09:45:13.832	ERROR	user_external_login/user_external_login_service.go:235	code: 500, reason: base.database_error, message: , error: Error 1406: Data too long for column 'avatar' at row 1
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/answerdev/answer/internal/repo/user/user_repo.go:152 github.com/answerdev/answer/internal/repo/user.(*userRepo).UpdateInfo
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/answerdev/answer/internal/service/user_external_login/user_external_login_service.go:233 github.com/answerdev/answer/internal/service/user_external_login.(*UserExternalLoginService).activeUser
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/answerdev/answer/internal/service/user_external_login/user_external_login_service.go:93 github.com/answerdev/answer/internal/service/user_external_login.(*UserExternalLoginService).ExternalLogin
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/answerdev/answer/internal/controller/connector_controller.go:125 github.com/answerdev/answer/internal/controller.(*ConnectorController).ConnectorRedirect.func1
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/answerdev/answer/internal/controller/connector_controller.go:78 github.com/answerdev/answer/internal/controller.(*ConnectorController).ConnectorRedirectDispatcher
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/gin-gonic/gin/context.go:174 github.com/gin-gonic/gin.(*Context).Next
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/anargu/gin-brotli/gin_brotli.go:71 github.com/anargu/gin-brotli.Brotli.func1
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/gin-gonic/gin/context.go:174 github.com/gin-gonic/gin.(*Context).Next
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/gin-gonic/gin/gin.go:620 github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/go/src/github.com/answerdev/answer/answer_build3889548199/vendor/github.com/gin-gonic/gin/gin.go:576 github.com/gin-gonic/gin.(*Engine).ServeHTTP
/usr/local/go/src/net/http/server.go:2947 net/http.serverHandler.ServeHTTP
/usr/local/go/src/net/http/server.go:1991 net/http.(*conn).serve
/usr/local/go/src/runtime/asm_amd64.s:1594 runtime.goexit

Here is the json string for my avatar

{"type":"custom","gravatar":"https://www.gravatar.com/avatar/f449a0ac712b2575a9481318e96963b3","custom":"https://answer.salecto.io/uploads/avatar/4ZkqaeTV6gf.jpeg"}

I have replaced the string in the db with this, and now my user is able to log on without error again
{"type":"custom","gravatar":"","custom":""}

I expect that the reason for this, is that I have first setup gravatar, then uploaded an image, and then the oauth tries to also add a profile image, which probably results in the json exceeding 255 characters.

To Reproduce
Steps to reproduce the behavior:

  1. Setup gravatar
  2. Upload image instead
  3. Setup oauth
  4. Login with the user using oauth
  5. See error in the console

Expected behavior
NIL

Screenshots
image

Platform (please complete the following information):

  • Device: [e.g. Desktop, Mobile]
  • OS: [e.g. macOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions