Using fly volumes with Mnesia, Phoenix and Pow

Hey. I’m having an issue with Phoenix app that uses Pow (GitHub - danschultzer/pow: Robust, modular, and extendable user authentication system) for auth. I’m using Mnesia to save session. Locally everything works fine, and without adding Volumes everything also works fine. But when I’m adding a volume to app with:

source = "handshake_mnesia"
destination = "/mnesia"

and setting

config :mnesia, dir: '/mnesia'

in config/releases.exs

I get this error when starting an app:

[error] Couldn't initialize mnesia cluster because: {:change_table_copy_type, {:aborted, {:badarg, :schema, :unknown}}}

[info] Application handshake exited: Handshake.Application.start(:normal, []) returned an error: shutdown: failed to start child: Pow.Store.Backend.MnesiaCache
2021-06-22T11:53:01Z [info]     ** (EXIT) {:change_table_copy_type, {:aborted, {:badarg, :schema, :unknown}}}

Am I missing something? Thanks!

That error isn’t super helpful but there’s a good chance you’re hitting a permissions problem. The Elixir process might not have permissions to write to /mnesia.

Thanks! That actually fixed it!

1 Like

Hey, glad to hear you resolved the issue! Can you share what you did to fix the problem? It may help other developers in the future. Thanks in advance!