"Invalid node name!" when attempting to start a release

I’m attempting to deploy my Phoenix application.

It works fine when I start the server with MIX_ENV=prod mix phx.server.

But when I first create a release using MIX_ENV=prod mix release, and then try to start it, it crashes and all I get is this:

Invalid node name!
Please check your configuration

=SUPERVISOR REPORT==== 16-Jul-2021::09:16:12.177219 ===
    supervisor: {local,net_sup}
    errorContext: start_error
    reason: {'EXIT',nodistribution}
    offender: [{pid,undefined},
               {id,net_kernel},
               {mfargs,{net_kernel,start_link,[['@',longnames],true,net_sup]}},
               {restart_type,permanent},
               {significant,false},
               {shutdown,2000},
               {child_type,worker}]

=CRASH REPORT==== 16-Jul-2021::09:16:12.180392 ===
  crasher:
    initial call: net_kernel:init/1
    pid: <0.6812.0>
    registered_name: []
    exception exit: {error,badarg}
      in function  gen_server:init_it/6 (gen_server.erl, line 407)
    ancestors: [net_sup,kernel_sup,<0.6798.0>]
    message_queue_len: 0
    messages: []
    links: [<0.6809.0>]
    dictionary: [{longnames,true}]
    trap_exit: true
    status: running
    heap_size: 610
    stack_size: 29
    reductions: 4325
  neighbours:

=SUPERVISOR REPORT==== 16-Jul-2021::09:16:12.180680 ===
    supervisor: {local,kernel_sup}
    errorContext: start_error
    reason: {shutdown,
                {failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}
    offender: [{pid,undefined},
               {id,net_sup},
               {mfargs,{erl_distribution,start_link,[]}},
               {restart_type,permanent},
               {significant,false},
               {shutdown,infinity},
               {child_type,supervisor}]

=CRASH REPORT==== 16-Jul-2021::09:16:12.190387 ===
  crasher:
    initial call: application_master:init/4
    pid: <0.6797.0>
    registered_name: []
    exception exit: {{shutdown,
                         {failed_to_start_child,net_sup,
                             {shutdown,
                                 {failed_to_start_child,net_kernel,
                                     {'EXIT',nodistribution}}}}},
                     {kernel,start,[normal,[]]}}
      in function  application_master:init/4 (application_master.erl, line 142)
    ancestors: [<0.6796.0>]
    message_queue_len: 1
    messages: [{'EXIT',<0.6798.0>,normal}]
    links: [<0.6796.0>,<0.6795.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 610
    stack_size: 29
    reductions: 167
  neighbours:

=INFO REPORT==== 16-Jul-2021::09:16:12.191040 ===
    application: kernel
    exited: {{shutdown,
                 {failed_to_start_child,net_sup,
                     {shutdown,
                         {failed_to_start_child,net_kernel,
                             {'EXIT',nodistribution}}}}},
             {kernel,start,[normal,[]]}}
    type: permanent

{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{ker

Crash dump is being written to: erl_crash.dump...done

What does this error mean? Usually I find Elixir error messages to be very helpful, but this time I’m not even sure where to look.

Thanks

Sadly this error occurs before elixir is ever started, therefore that error can’t be intercepted and “prettified”.

Though from skimming the error it seems as if you are trying to use :@ as the node name. That’s not valid though.

Nodenames have to have a local and remote part, similar to email addresses.

As you also use longnames, the remote part has to have at least one dot or be a valid IPv4/v6 address.

1 Like

You’re right. I had some /rel/env-files from a previous deployment setup that messed things up.

@LostKobrakai pointed this out to me in the Slack channel, and after I removed those files it works as expected.

Thanks!

1 Like