gotrue
gotrue copied to clipboard
`Error opening database: invalid bool value: true` while using `parseTime` and `multiStatements` in `DATABASE_URL`
While setting gotrue on a Azure VM, I was using the following variable in a .env file,
DATABASE_URL="root:root@tcp(localhost)/gotrue?parseTime=true&multiStatements=true"
and after running the Docker image,
$> docker run --rm --env-file .env gotrue
time="2023-12-02T14:23:17.843345898Z" level=debug msg="Set log level to: debug"
time="2023-12-02T14:23:17Z" level=fatal msg="Error opening database: invalid bool value: true\"\nthe URL '\"root:root@tcp(localhost)/gotrue?parseTime=true&multiStatements=true\"' is not supported by MySQL driver\ngithub.com/gobuffalo/pop/v5.urlParserMySQL\n\t/go/pkg/mod/github.com/gobuffalo/pop/[email protected]/dialect_mysql.go:204\ngithub.com/gobuffalo/pop/v5.(*ConnectionDetails).withURL\n\t/go/pkg/mod/github.com/gobuffalo/pop/[email protected]/connection_details.go:101\ngithub.com/gobuffalo/pop/v5.(*ConnectionDetails).Finalize\n\t/go/pkg/mod/github.com/gobuffalo/pop/[email protected]/connection_details.go:137\ngithub.com/gobuffalo/pop/v5.NewConnection\n\t/go/pkg/mod/github.com/gobuffalo/pop/[email protected]/connection.go:60\ngithub.com/netlify/gotrue/storage.Dial\n\t/go/src/github.com/netlify/gotrue/storage/dial.go:31\ngithub.com/netlify/gotrue/cmd.serve\n\t/go/src/github.com/netlify/gotrue/cmd/serve_cmd.go:24\ngithub.com/netlify/gotrue/cmd.execWithConfig\n\t/go/src/github.com/netlify/gotrue/cmd/root_cmd.go:37\ngithub.com/netlify/gotrue/cmd.glob..func4\n\t/go/src/github.com/netlify/gotrue/cmd/root_cmd.go:15\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:844\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:945\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:885\nmain.main\n\t/go/src/github.com/netlify/gotrue/main.go:10\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:204\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1374\nopening database connection\ngithub.com/netlify/gotrue/storage.Dial\n\t/go/src/github.com/netlify/gotrue/storage/dial.go:36\ngithub.com/netlify/gotrue/cmd.serve\n\t/go/src/github.com/netlify/gotrue/cmd/serve_cmd.go:24\ngithub.com/netlify/gotrue/cmd.execWithConfig\n\t/go/src/github.com/netlify/gotrue/cmd/root_cmd.go:37\ngithub.com/netlify/gotrue/cmd.glob..func4\n\t/go/src/github.com/netlify/gotrue/cmd/root_cmd.go:15\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:844\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:945\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:885\nmain.main\n\t/go/src/github.com/netlify/gotrue/main.go:10\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:204\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1374"
The example.env also has a similar value for DATABASE_URL. I tried removing the parameters parseTime and multiStatements from the URL, but then the warnings persist.
MySQL version: mysql Ver 8.0.35-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
Update
DATABASE_URL when provided with the docker run command works without any error:
$> sudo docker run --rm --env-file .env -e DATABASE_URL="root:root@tcp(127.0.0.1:3306)/gotrue_development?parseTime=true&multiStatements=true" gotrue
time="2023-12-02T14:39:40.58839382Z" level=debug msg="Set log level to: debug"
time="2023-12-02T14:39:40Z" level=info msg="GoTrue API started on: localhost:9999"