Skip to content

Force IPv4 for knowledge-search indexer DB connections on GitHub Actions#741

Merged
ss-o merged 2 commits into
mainfrom
copilot/fix-knowledge-search-network-error
May 23, 2026
Merged

Force IPv4 for knowledge-search indexer DB connections on GitHub Actions#741
ss-o merged 2 commits into
mainfrom
copilot/fix-knowledge-search-network-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

knowledge-search:index fails on ubuntu-latest because the Supabase hostname can resolve to IPv6, while the runner has no outbound IPv6 route (ENETUNREACH). This change forces IPv4 address selection for the indexer’s Postgres connection.

  • Connection behavior update (scripts/knowledge-search/embed-docs.mjs)

    • Updated postgres() client options to include family: 4.
    • Kept existing SSL behavior unchanged.
  • Why this addresses the failure

    • postgres.js now resolves/uses IPv4 for the DB socket, avoiding unreachable IPv6 paths on the GitHub-hosted runner.
const sql = postgres(env.SUPABASE_DB_URL, {
  ssl: env.SUPABASE_DB_SSL === "disable" ? false : "require",
  family: 4,
});
Original prompt

Problem

The knowledge-search:index job fails immediately with a network error on GitHub Actions runners:

Error: connect ENETUNREACH 2a05:d014:8ef:5900:cb94:a6b2:c8f1:2a45:5432

The Supabase hostname resolves to an IPv6 address, but ubuntu-latest GitHub Actions runners do not have outbound IPv6 connectivity, so the connection is unreachable.

Fix

In scripts/knowledge-search/embed-docs.mjs, add family: 4 to the postgres() connection options to force IPv4 DNS resolution:

// Before (line 27)
const sql = postgres(env.SUPABASE_DB_URL, {ssl: env.SUPABASE_DB_SSL === "disable" ? false : "require"});

// After
const sql = postgres(env.SUPABASE_DB_URL, {
  ssl: env.SUPABASE_DB_SSL === "disable" ? false : "require",
  family: 4,
});

The family: 4 option is supported by postgres.js and instructs the underlying Node.js net module to resolve the hostname to an IPv4 address only, bypassing the unreachable IPv6 address.

No other files need to be changed.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: I'll grab the job logs right away!

Assistant: ## Problem

The job fails immediately with a network error trying to connect to the Supabase PostgreSQL database on port 5432:

Error: connect ENETUNREACH 2a05:d014:8ef:5900:cb94:a6b2:c8f1:2a45:5432

The address 2a05:d014:... is IPv6. GitHub Actions ubuntu-latest runners do not have outbound IPv6 connectivity, so the connection is unreachable. The postgres client is resolving the Supabase hostname to an IPv6 address and failing before even attempting IPv4.

Solution

Force the postgres client to use IPv4 by passing family: 4 in the connection options. In scripts/knowledge-search/embed-docs.mjs, update line 27:

// Before
const sql = postgres(env.SUPABASE_DB_URL, {ssl: env.SUPABASE_DB_SSL === "disable" ? false : "require"});

// After
const sql = postgres(env.SUPABASE_DB_URL, {
  ssl: env.SUPABASE_DB_SSL === "disable" ? false : "require",
  family: 4,
});

The family: 4 option is supported by postgres.js and instructs the underlying Node.js net module to resolve the hostname to an IPv4 address only, bypassing the IPv6 address that the GitHub Actions runner can't reach.

User: Open PR please

Assistant: We're waiting for your response to the tool confirmation dialog to proceed with creating the pull request.

This pull request was created from Copilot chat.

Copilot AI requested review from Copilot and removed request for Copilot May 22, 2026 09:47
Copilot AI requested review from Copilot and removed request for Copilot May 22, 2026 09:51
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 22, 2026

Deploying zsh with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6bea222
Status: ✅  Deploy successful!
Preview URL: https://c2024bea.zsh.pages.dev
Branch Preview URL: https://copilot-fix-knowledge-search.zsh.pages.dev

View logs

Copilot AI changed the title [WIP] Fix network error in knowledge-search:index job Force IPv4 for knowledge-search indexer DB connections on GitHub Actions May 22, 2026
Copilot finished work on behalf of ss-o May 22, 2026 09:52
Copilot AI requested a review from ss-o May 22, 2026 09:52
@ss-o ss-o marked this pull request as ready for review May 22, 2026 09:59
@ss-o ss-o requested review from a team and Copilot May 22, 2026 09:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a CI reliability issue where the knowledge-search indexer fails on GitHub Actions runners due to Supabase resolving to an IPv6 address while ubuntu-latest lacks outbound IPv6 routing.

Changes:

  • Forces IPv4 DNS selection for the indexer’s Postgres connection by passing family: 4 to postgres() in the embedding/indexing script.

Comment thread scripts/knowledge-search/embed-docs.mjs
@ss-o ss-o merged commit 2dcf867 into main May 23, 2026
8 checks passed
@ss-o ss-o deleted the copilot/fix-knowledge-search-network-error branch May 23, 2026 06:39
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.

3 participants