Skip to content

Replace dead ipfs.kleros.io gateway and add fetch resilience to article loading#262

Merged
0xferit merged 5 commits intodevelopfrom
copilot/fix-ipfs-unreachable-issue
Mar 9, 2026
Merged

Replace dead ipfs.kleros.io gateway and add fetch resilience to article loading#262
0xferit merged 5 commits intodevelopfrom
copilot/fix-ipfs-unreachable-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

ipfs.kleros.io no longer resolves in DNS, causing TypeError: Failed to fetch that propagates through the React Router loader and crashes every page that loads article content.

Changes

  • Gateway URL: ipfs.kleros.iocdn.kleros.link in src/utils/addToIPFS.js
  • Error handling in populateArticleContents: Removed the throw new Error(error.message) re-throw in the per-article catch block. A single unreachable IPFS file no longer crashes the entire browse page — failed articles are still returned (without content fields populated) while successfully fetched articles render normally.
# src/utils/populateArticleContents.js
        } catch (error) {
            console.error(error);
-           throw new Error(error.message);
        }
+       return article;
    });

-   await Promise.all(fetchPromises);
-   return articles;
+   const results = await Promise.all(fetchPromises);
+   return results.filter(Boolean);
Original prompt

This section details on the original issue you should resolve

<issue_title>Bug: ipfs.kleros.io is unreachable — app crashes on all routes that load article content</issue_title>
<issue_description>## Summary

The IPFS gateway ipfs.kleros.io is completely unreachable (DNS resolution fails). This causes a fatal "Unexpected Application Error! — Failed to fetch" on every route that loads article content, including the main browse page (/:chain) and individual article pages (/:chain/:contract/:id).

Affected URL example: https://truthpost.news/0x1/

Root Cause

ipfs.kleros.io no longer resolves in DNS. Every call to fetch("https://ipfs.kleros.io" + article.articleID) fails immediately.

The crash path is:

  1. src/routes/browse/index.jsxloader() calls getAllArticles(params.chain) — this succeeds (the subgraph at api.studio.thegraph.com works fine and returns articles).
  2. loader() then calls populateArticleContents(articles) (src/utils/populateArticleContents.js), which calls fetch(ipfsGateway + article.articleID) for every article.
  3. ipfsGateway is defined in src/utils/addToIPFS.js as "https://ipfs.kleros.io".
  4. Since the host is unreachable, fetch throws TypeError: Failed to fetch.
  5. populateArticleContents re-throws this as new Error(error.message), which propagates up through the React Router loader and crashes the entire page with the unhandled error boundary.

Evidence

# DNS lookup fails
$ dig +short ipfs.kleros.io
# (no results)

# curl confirms
$ curl -v https://ipfs.kleros.io
# curl: (6) Could not resolve host: ipfs.kleros.io

# Meanwhile, the subgraph works fine
$ curl -s -X POST -H "Content-Type: application/json" \
  -d '{"query":"{ _meta { block { number } } }"}' \
  "https://api.studio.thegraph.com/query/88965/thetruthpost/version/latest"
# {"data":{"_meta":{"block":{"number":24621644}}}}

# And the article content IS available via other IPFS gateways
$ curl -sL "https://dweb.link/ipfs/QmdknTN8NiM8j9NNjsPhxgPUDe8MjXmeLEWgnUgt95FSpN" | head -c 200
# Returns valid JSON with title, description, etc.

Fix

In src/utils/addToIPFS.js, replace the dead gateway with a working one:

- export const ipfsGateway = 'https://ipfs.kleros.io'
+ export const ipfsGateway = 'https://cdn.kleros.link'

Alternatively, https://cloudflare-ipfs.com or https://dweb.link also work. Consider using a gateway that Kleros still maintains (cdn.kleros.link), or adding fallback logic.

Additionally, populateArticleContents should be made more resilient — a single unreachable IPFS file should not crash the entire page. Consider catching per-article errors gracefully so the browse page still renders articles whose content could be fetched.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…e populateArticleContents resilient to per-article failures

Co-authored-by: 0xferit <3106907+0xferit@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 9, 2026

Deploying webapp-tp with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1a41367
Status:🚫  Build failed.

View logs

Co-authored-by: 0xferit <3106907+0xferit@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix app crash due to unreachable IPFS gateway Replace dead ipfs.kleros.io gateway and add fetch resilience to article loading Mar 9, 2026
@0xferit 0xferit marked this pull request as ready for review March 9, 2026 19:30
@0xferit 0xferit merged commit 534de0c into develop Mar 9, 2026
1 check failed
@0xferit 0xferit deleted the copilot/fix-ipfs-unreachable-issue branch March 9, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: ipfs.kleros.io is unreachable — app crashes on all routes that load article content

2 participants