ipfs/helia-http-gateway

bug: /ipns/strn.network request results in invalid request

Closed this issue · 3 comments

I'm not sure which request is kicking off that is causing this (I assume it's not the primary call, and one of the children calls) but I have consistently reproduced this error in the tests i have been doing over at #18 (comment)

[11:27:26.544] ERROR (94466): helia-http-gateway:fastifyPath: /ipfs/ is not valid, provide path as /ipfs/<cid> or /ipns/<path>
    reqId: "req-z"
    req: {
      "method": "GET",
      "url": "/ipns/strn.network",
      "hostname": "localhost:8080",
      "remoteAddress": "127.0.0.1",
      "remotePort": 51797
    }
    res: {
      "statusCode": 500
    }
    err: {
      "type": "Error",
      "message": "Path: /ipfs/ is not valid, provide path as /ipfs/<cid> or /ipns/<path>",
      "stack":
          Error: Path: /ipfs/ is not valid, provide path as /ipfs/<cid> or /ipns/<path>
              at HeliaFetch.parsePath (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/helia-http-gateway/dist/src/heliaFetch.js:69:19)
              at HeliaFetch.fetchPath (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/helia-http-gateway/dist/src/heliaFetch.js:108:63)
              at HeliaFetch.fetchIpns (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/helia-http-gateway/dist/src/heliaFetch.js:151:21)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async HeliaFetch.fetch (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/helia-http-gateway/dist/src/heliaFetch.js:91:28)
              at async HeliaServer._fetch (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/helia-http-gateway/dist/src/heliaServer.js:116:35)
              at async HeliaServer.fetchWithoutSubdomain (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/helia-http-gateway/dist/src/heliaServer.js:105:13)
    }

Further testing shows that the DNS response is not being parsed properly:

2023-11-07T21:56:34.871Z helia-http-gateway:fastify:helia-fetch Processing Fetch: { namespace: 'ipns', address: 'strn.network', relativePath: undefined }
2023-11-07T21:56:34.871Z helia-http-gateway:fastify:helia-fetch Fetching from DNS over HTTP: strn.network
2023-11-07T21:56:42.452Z helia-http-gateway:fastify:helia-fetch Got Path from DNS over HTTP: /ipfs/
2023-11-07T21:56:42.452Z helia-http-gateway:fastify:helia-fetch Final IPFS path: /ipfs/
2023-11-07T21:56:42.452Z helia-http-gateway:fastify:helia-fetch Fetching: /ipfs/
2023-11-07T21:56:42.452Z helia-http-gateway:fastify:helia-fetch Parsing path: /ipfs/
2023-11-07T21:56:42.452Z helia-http-gateway:fastify:helia-fetch Error parsing path: /ipfs/: null
2023-11-07T21:56:42.452Z helia-http-gateway:fastify:helia-fetch Error fetching: /ipfs/ Error: Path: /ipfs/ is not valid, provide path as /ipfs/<cid> or /ipns/<path>
╰─ ✔ ❯ dig +noall +answer TXT _dnslink.strn.network            4.69   28.9G   45%   100%  ─╯
_dnslink.strn.network.	60	IN	CNAME	_dnslink.strn-network.on.fleek.co.
_dnslink.strn-network.on.fleek.co. 120 IN TXT	"dnslink=/ipfs/"
╰─ ✔ ❯ curl -i http://strn.network
HTTP/1.1 302 Moved Temporarily
Date: Tue, 07 Nov 2023 22:04:58 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Thu, 01 Jan 1970 00:00:01 GMT
Location: https://saturn.tech/
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=pTvcLd7G6pOjV1kDgBQEuDD9xc4iKj6tVV%2B1Y3Wl6YCH5E9%2B8vLoYoF0ocam5NwF4S%2Fo8HuCfgTZ7rVfGYFDQ8GFeXfgUxibNA5C9EA2BiiT58VCK3GqnM0z%2FKg53Co%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 8228e00199b06c8a-SEA
alt-svc: h3=":443"; ma=86400