title: pm2 autostart discord.js bot won't connect again on reboot (raspberry pi)
body: <p>I am hosting a discord.js bot on my raspberry pi 4.
  It connects flawlessly when I do it manually with <code>pm2 start index.js</code>
  Now the issue is when I tried to add it to autostart</p>
  
  <pre><code>pm2 autostart
  sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi
  pm2 save
  </code></pre>
  
  <p>Now when I restart I the process has started up, I get this when I type <code>pm2 list</code>
  <a href="https://i.stack.imgur.com/08WzC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/08WzC.png" alt="enter image description here"></a></p>
  
  <p>but the bot will be offline on discord.</p>
  
  <p>In the error logs I have this error repeating multiple times:</p>
  
  <pre><code>Error: getaddrinfo EAI_AGAIN discordapp.com discordapp.com:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
  </code></pre>
  
  <p>However if I restart with <code>pm2 restart 0</code> the discord bot will be online again.</p>