denoland / deploy_feedback

For reporting issues with Deno Deploy
https://deno.com/deploy
74 stars 5 forks source link

[Bug]: deno deploy serverless cannot access ipv6 network #598

Open masx200 opened 7 months ago

masx200 commented 7 months ago

Problem description

IpNotFoundError: Could not get the public IP address
    at file:///node_modules/.deno/public-ip@6.0.1/node_modules/public-ip/index.js:193:10
    at Object.runMicrotasks (ext:core/01_core.js:934:26)
    at processTicksAndRejections (ext:deno_node/_next_tick.ts:53:10)
    at runNextTicks (ext:deno_node/_next_tick.ts:71:3)
    at eventLoopTick (ext:core/01_core.js:189:21)
    at async file:///node_modules/.deno/public-ip@6.0.1/node_modules/public-ip/index.js:220:15
    at async file:///src/main.ts:7:15
    at async ext:deno_http/00_serve.js:457:18
Caused by RequestError: error sending request for url (https://api6.ipify.org/): error trying to connect: tcp connect error: Cannot assign requested address (os error 99)
    at HttpsClientRequest.<anonymous> (file:///node_modules/.deno/got@12.6.1/node_modules/got/dist/source/core/index.js:790:107)
    at Object.onceWrapper (ext:deno_node/_stream.mjs:1931:30)
    at HttpsClientRequest.emit (ext:deno_node/_stream.mjs:1859:11)
    at node:http:534:16
    at eventLoopTick (ext:core/01_core.js:182:7)
    at async node:http:447:21 {
  name: "IpNotFoundError"
}

Steps to reproduce

import { publicIp, publicIpv4, publicIpv6 } from "npm:public-ip@6.0.1";
await Deno.serve(async (req: Request) =>
  new Response(
    JSON.stringify({
      "internal": Deno.networkInterfaces(),
      "public": {
        ipv6: await publicIpv6(),

        ipv4: await publicIpv4(),
      },
    }),
  )
);

Expected behavior


{
  "internal": [

    {
      "family": "IPv6",
      "name": "以太网 2",
      "address": "240e:388:9c06:c500:1165:ba19:ad8f:5834",
      "netmask": "ffff:ffff:ffff:ffff::",
      "scopeid": 0,
      "cidr": "240e:388:9c06:c500:1165:ba19:ad8f:5834/64",
      "mac": "00:e0:4c:68:35:54"
    },
    {
      "family": "IPv6",
      "name": "以太网 2",
      "address": "240e:388:9c06:c500:8c8d:fa95:f50e:1689",
      "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
      "scopeid": 0,
      "cidr": "240e:388:9c06:c500:8c8d:fa95:f50e:1689/128",
      "mac": "00:e0:4c:68:35:54"
    },
    {
      "family": "IPv6",
      "name": "以太网 2",
      "address": "fe80::a135:a40f:696f:daf5",
      "netmask": "ffff:ffff:ffff:ffff::",
      "scopeid": 9,
      "cidr": "fe80::a135:a40f:696f:daf5/64",
      "mac": "00:e0:4c:68:35:54"
    },
    {
      "family": "IPv4",
      "name": "以太网 2",
      "address": "192.168.31.108",
      "netmask": "255.255.255.0",
      "scopeid": null,
      "cidr": "192.168.31.108/24",
      "mac": "00:e0:4c:68:35:54"
    },
    {
      "family": "IPv6",
      "name": "Loopback Pseudo-Interface 1",
      "address": "::1",
      "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
      "scopeid": 0,
      "cidr": "::1/128",
      "mac": "00:00:00:00:00:00"
    },
    {
      "family": "IPv4",
      "name": "Loopback Pseudo-Interface 1",
      "address": "127.0.0.1",
      "netmask": "255.0.0.0",
      "scopeid": null,
      "cidr": "127.0.0.1/8",
      "mac": "00:00:00:00:00:00"
    }
  ],
  "public": {
    "ipv6": "240e:388:9c06:c500:8c8d:fa95:f50e:1689",
    "ipv4": "116.238.127.118"
  }
}

Environment

No response

Possible solution

No response

Additional context

No response

sambskn commented 7 months ago

I'm getting what I believe is a similar error when trying to connect to my Supabase Postgres instance, now that Supabase has migrated to IPV6.


Error: Database issue
    at getBotIdForMessage (file:///src/routes/api/gmCallback.tsx:126:15)
    at eventLoopTick (ext:core/01_core.js:182:7)
    at async POST (file:///src/routes/api/gmCallback.tsx:35:31)
    at async handler (https://deno.land/x/fresh@1.6.3/src/server/context.ts:288:14)
    at async ext:deno_http/00_serve.js:457:18

An error occurred during route handling or page rendering.

AddrNotAvailable: Cannot assign requested address (os error 99)
    at async Object.connect (ext:deno_net/01_net.js:511:55)
    at cachedError (https://deno.land/x/postgresjs@v3.4.3/src/query.js:170:23)
    at new Query (https://deno.land/x/postgresjs@v3.4.3/src/query.js:36:24)
    at sql (https://deno.land/x/postgresjs@v3.4.3/src/index.js:113:11)
    at getBotIdForMessage (file:///src/routes/api/gmCallback.tsx:116:32) {
  name: "AddrNotAvailable",
  code: "EADDRNOTAVAIL"
}

At least that's my best guess, can't seem to find another reason why this only fails on Deno Deploy for me.