Search code examples
gobuffalo

Go Buffalo test with sqlite error: could not find connection named test


Buffalo test error on a new project I created with this command.

buffalo new coke --db-type sqlite3
buffalo test

Here is the error:

[POP] 2023/02/23 13:43:02 warn - unable to load connection development: could not create new connection: sqlite3 support was not compiled into the binary
[POP] 2023/02/23 13:43:02 warn - unable to load connection test: could not create new connection: sqlite3 support was not compiled into the binary
[POP] 2023/02/23 13:43:02 warn - unable to load connection production: could not create new connection: sqlite3 support was not compiled into the binary
Usage:
  buffalo test [flags]

Flags:
  -h, --help   help for test

ERRO[0000] Error: could not find connection named test  

Was there something I miss before running the test on this project? Somebody please let me know. Thank you


Solution

  • The 2nd line of your output,

    [POP] 2023/02/23 13:43:02 warn - <...>: sqlite3 support was not compiled into the binary
    

    As you can see here, the root cause is that your buffalo binary was not compiled to support SQLite3. How did you install it? If you used go install, you should use -tags sqlite option so the command like should be

    go install -tags sqlite github.com/gobuffalo/cli/cmd/buffalo@latest
    

    See the document for more installation options.

    https://gobuffalo.io/documentation/getting_started/installation/#custom-installation-with-sqlite3-support