'Deploying Elixir Docker to Heroku. Can't set long node name

I'm trying to deploy a Dockerfile to Heroku and when the app starts, it immediately crashes with this error:

=INFO REPORT==== 2-Apr-2022::16:20:30.959748 ===
Can't set long node name!
Please check your configuration

=SUPERVISOR REPORT==== 2-Apr-2022::16:20:30.960208 ===
supervisor: {local,net_sup}
errorContext: start_error
reason: {'EXIT',nodistribution}
offender: [{pid,undefined},
{id,net_kernel},
{mfargs,{net_kernel,start_link,
[[api@,longnames],true,net_sup]}},
{restart_type,permanent},
{significant,false},
{shutdown,2000},
{child_type,worker}]

=CRASH REPORT==== 2-Apr-2022::16:20:30.960246 ===
crasher:
initial call: net_kernel:init/1
pid: <0.3363.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.3349.0>]
message_queue_len: 0
messages: []
links: [<0.3360.0>]
dictionary: [{longnames,true}]
trap_exit: true
status: running
heap_size: 987
stack_size: 28
reductions: 770
neighbours:

=SUPERVISOR REPORT==== 2-Apr-2022::16:20:30.963246 ===
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==== 2-Apr-2022::16:20:30.966821 ===
crasher:
initial call: application_master:init/4
pid: <0.3348.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.3347.0>]
message_queue_len: 1
messages: [{'EXIT',<0.3349.0>,normal}]
links: [<0.3347.0>,<0.3346.0>]
dictionary: []
trap_exit: true
status: running
heap_size: 610
stack_size: 28
reductions: 165
neighbours:

=INFO REPORT==== 2-Apr-2022::16:20:30.967283 ===
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
Process exited with status 1
State changed from starting to crashed

Let me know if theres specific info you need to help me narrow the problem down.

Anyone have any ideas?



Solution 1:[1]

I had a rel/env.sh.eex file that was setting

export RELEASE_DISTRIBUTION=name
export RELEASE_NODE=api@${POD_IP}

where POD_IP was not set, causing the error.

Solution 2:[2]

You should check your pc's os hostname. It should contain ".",otherwise long name can't be used.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 atomkirk
Solution 2 Chen Yu