Mix ecto.create Argument Error

I’ve recently installed Phoenix/Elixir from source on a shared server instance. I’ve configured a Postgres database and ensured it was running via the command line. I placed the database details in my devs.exs file (below)

# Configure your database
config :scandimension, Scandimension.Repo,
  username: "scandimension",
  password: "password",
  database: "greenwavesoftware",
  hostname: "localhost",
  port: "12335",
  pool_size: 10

I’ve verified the settings by connecting with them via the CLI.

When I run ecto.create in my Phoenix application, I get the following error:

$ mix ecto.create
** (ArgumentError) argument error
    :erlang.hd([])
    lib/mix/ecto.ex:46: Mix.Ecto.parse_repo/2
    lib/mix/tasks/ecto.create.ex:46: Mix.Tasks.Ecto.Create.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2
$ 

Going directly into the database shows:

$ psql -h localhost -p 12335 greenwavesoftware
psql (9.4.21)
Type "help" for help.

greenwavesoftware=# \l
                                    List of databases
       Name        |   Owner   | Encoding | Collate | Ctype |      Access privileges      
-------------------+-----------+----------+---------+-------+-----------------------------
 greenwavesoftware | chipcoons | UTF8     | C       | C     | =Tc/chipcoons              +
                   |           |          |         |       | chipcoons=CTc/chipcoons    +
                   |           |          |         |       | scandimension=CTc/chipcoons
 postgres          | chipcoons | UTF8     | C       | C     | 
 template0         | chipcoons | UTF8     | C       | C     | =c/chipcoons               +
                   |           |          |         |       | chipcoons=CTc/chipcoons
 template1         | chipcoons | UTF8     | C       | C     | =c/chipcoons               +
                   |           |          |         |       | chipcoons=CTc/chipcoons
(4 rows)

greenwavesoftware=# 

I’ve also tried changing the credentials used to my ‘owner’ credentials rather than the user I created for the app to use.

The server environment is Webfaction.

Any suggestions appreciated.

:wave:

The error seems to indicate that the repo isn’t found and you have empty apps list (since hd(apps) fails). Can you post more of your config related to the ecto repo?

What happens if you try mix ecto.create -r Scandimension.Repo?

Do you have

config :scandimension, ecto_repos: [...]

or something similar anywhere in your config?

1 Like

mix ecto.create -r Scandimension.Repo

Has provided a good indication of the problem:

** (Mix) The database for Scandimension.Repo couldn’t be created: ERROR 42501 (insufficient_privilege) permission denied to create database
.
Now I have to figure out why, since the user provided should have full privileges. Thanks for the timely response. I have to say I’m very impressed by the willingness of the community to help a noob.