elk icon indicating copy to clipboard operation
elk copied to clipboard

Elk gets confused by ipv6 without dns

Open dilinger opened this issue 2 years ago • 1 comments

Pre-Checks

  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
  • [X] Providing a screenshot or video to reproduce the issue or show visually what was meant.
  • [ ] I am willing to provide a PR.

Describe the bug

I'm running elk locally on a machine on my home network to debug/develop a separate issue. At home I just used a private ipv4 address (192.168.x.x) to reach it, and it was fine. When I left home and wanted to work on the bug, when I tried to reach the private ipv6 address (which I'm tunneled to using yggdrasil), I get a backtrace and all kinds of errors when I connect to it. See the screenshot below and additional context.

Reproduction video or screenshot

Screenshot-2023-01-18,16-20-00

Additional Context

I start the server:

(elk-git)elk-git@hm90:/elk$ HOST='200:6873:2359:a0d1:ef41:f25d:c973:dc04' pnpm dev
                                                                                              21:19:03
Nuxi 3.0.0                                                                                    21:19:03
Nuxt 3.0.0 with Nitro 1.0.0                                                                   21:19:03
                                                                                              21:19:04
  > Listening:    http://200:6873:2359:a0d1:ef41:f25d:c973:dc04:5314/ 
  > Vue Inspector: Press Meta+Shift in App to toggle the Inspector                            21:19:06

 WARN  [@vue/reactivity-transform] Reactivity transform is an experimental feature.           21:19:07
Experimental features may change behavior between patch versions.
It is recommended to pin your vue dependencies to exact versions to avoid breakage.
You can follow the proposal's status at https://github.com/vuejs/rfcs/discussions/369.

                                                                                              21:19:03
ℹ Vite client warmed up in 5901ms                                                             21:19:12
✔ Nitro built in 696 ms                                                                 nitro 21:19:13

Then, I try to load the site (http://[200:6873:2359:a0d1:ef41:f25d:c973:dc04]:5314/) in my browser; I get the above screenshot in my browser, and the following backtrace on the console:

[nuxt] [request error] [unhandled] [500] Failed to parse URL from http://200:6873:2359:a0d1:ef41:f25d:c973:dc04:5314/__nuxt_vite_node__/manifest ()
  at async $fetchRaw2 (./node_modules/.pnpm/[email protected]/node_modules/ofetch/dist/shared/ofetch.5cb01515.mjs:142:24)  
  at async ./.nuxt/dev/index.mjs:756:20  
  at async ./.nuxt/dev/index.mjs:830:64  
  at async ./.nuxt/dev/index.mjs:110:22  
  at async Object.handler (./node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:723:19)  
  at async Server.toNodeHandle (./node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:798:7)
[nuxt] [request error] [unhandled] [500] Failed to parse URL from http://200:6873:2359:a0d1:ef41:f25d:c973:dc04:5314/__nuxt_vite_node__/manifest ()
  at async $fetchRaw2 (./node_modules/.pnpm/[email protected]/node_modules/ofetch/dist/shared/ofetch.5cb01515.mjs:142:24)  
  at async ./.nuxt/dev/index.mjs:756:20  
  at async ./.nuxt/dev/index.mjs:830:64  
  at async ./.nuxt/dev/index.mjs:110:22  
  at async Object.handler (./node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:723:19)  
  at async toNodeHandle (./node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:798:7)  
  at async Object.ufetch [as localFetch] (./node_modules/.pnpm/[email protected]/node_modules/unenv/runtime/fetch/index.mjs:9:17)  
  at async Object.errorhandler [as onError] (./.nuxt/dev/index.mjs:443:30)  
  at async Server.toNodeHandle (./node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:805:9)

It almost looks as though something internal dropped the brackets from the url, and then some node library gets confused parsing it.

I did manage to work around it by adding an entry to /etc/hosts in the chroot, and starting the server with the name alias rather than the raw ipv6 address. That seems to work, and I can connect to the site as expected with my browser.

(elk-git)elk-git@hm90:/elk$ grep ipv6 /etc/hosts
200:6873:2359:a0d1:ef41:f25d:c973:dc04 hm90-ipv6
(elk-git)elk-git@hm90:/elk$ HOST='hm90-ipv6' pnpm dev

Nuxi 3.0.0                                                                                    21:31:06
Nuxt 3.0.0 with Nitro 1.0.0                                                                   21:31:06
                                                                                              21:31:07
  > Listening:    http://hm90-ipv6:5314/ 

  > Vue Inspector: Press Meta+Shift in App to toggle the Inspector                            21:31:09

dilinger avatar Jan 18 '23 21:01 dilinger

Solve in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.