我正在尝试创建一个简单的GoBuffalo应用程序,允许用户注册和登录。
我一直跟随着这个例子link
我并遇到一些非常奇怪的行为,在极少数情况下,注册成功完成并创建了一个用户,但是通常,我会收到
mysql create: driver: bad connection
我仅将docker mysql:5.7镜像用于我的数据库。但是也尝试过postgres并收到相同的错误。
我的代码中的验证步骤似乎正确执行了(检查重复的用户名和电子邮件),但是当pop.connection转到insert(create)时,就会发生此错误。
我仍然是Go的新手,但如果有任何帮助可以使我的问题更加简洁,我将不胜感激。另外,有足够声誉的人可以帮助我制作gobuffalo标签。这是在Go中构建Web应用程序的绝佳框架。
INFO[2018-06-19T18:24:31-06:00] / content_type=text/html db="0s" duration="6.200086ms" human_size="6.1 kB" method=GET params="{}" path=/ render="1.503857ms" request_id="1fe52cdff5-bd0573a0f7" size="6138" status="200"
INFO[2018-06-19T18:24:34-06:00] /users/register content_type=text/html db="0s" duration="5.921511ms" human_size="3.2 kB" method=GET params="{}" path=/users/register render="876.053µs" request_id="1fe52cdff5-7905c7b909" size="3236" status="200"
DEBU[2018-06-19T18:24:39-06:00] SELECT users.admin, users.created_at, users.email, users.id, users.password_hash, users.updated_at, users.username FROM users AS users WHERE username = ? LIMIT 1 $1=testuser
DEBU[2018-06-19T18:24:39-06:00] SELECT users.admin, users.created_at, users.email, users.id, users.password_hash, users.updated_at, users.username FROM users AS users WHERE email = ? LIMIT 1 $1=testuser@gmail.com
[mysql] 2018/06/19 18:24:39 packets.go:427: busy buffer
[mysql] 2018/06/19 18:24:39 packets.go:58: malformed packet
[mysql] 2018/06/19 18:24:39 packets.go:408: busy buffer
DEBU[2018-06-19T18:24:39-06:00] INSERT INTO users (admin, created_at, email, id, password_hash, updated_at, username) VALUES (:admin, :created_at, :email, :id, :password_hash, :updated_at, :username)
[mysql] 2018/06/19 18:24:39 connection.go:157: invalid connection
INFO[2018-06-19T18:24:39-06:00] /users/register content_type=application/x-www-form-urlencoded db="7.352393ms" duration="88.455423ms" form="{\"Email\":[\"sestenssoro@seaspanltd.ca\"],\"Password\":[\"seb132435\"],\"PasswordConfirm\":[\"seb132435\"],\"Username\":[\"sestenssoro\"],\"authenticity_token\":[\"ZlsaHOhGYo06KIwZ7+g6tVuRcnxkUfLP4coew2K32z5Vi5nQWX2Dn8scKcyMMD1R9NoP9OCEDs+5aN54pwhJjg==\"]}" human_size="0 B" method=POST params="{}" path=/users/register request_id="1fe52cdff5-5c2a2e15cf" size="0" status="0"
ERRO[2018-06-19T18:24:39-06:00] mysql create: driver: bad connection content_type=application/x-www-form-urlencoded db="7.352393ms" duration="88.455423ms" form="{\"Email\":[\"testuser@gmail.com\"],\"Password\":[\"password\"],\"PasswordConfirm\":[\"password\"],\"Username\":[\"testuser\"],\"authenticity_token\":[\"ZlsaHOhGYo06KIwZ7+g6tVuRcnxkUfLP4coew2K32z5Vi5nQWX2Dn8scKcyMMD1R9NoP9OCEDs+5aN54pwhJjg==\"]}" human_size="0 B" method=POST params="{}" path=/users/register request_id="1fe52cdff5-5c2a2e15cf" size="0" status="0"