Skip to content

fix: add timeout and use HEAD for registry URL validation#2130

Open
manja316 wants to merge 1 commit intoasyncapi:masterfrom
manja316:fix/registry-url-timeout
Open

fix: add timeout and use HEAD for registry URL validation#2130
manja316 wants to merge 1 commit intoasyncapi:masterfrom
manja316:fix/registry-url-timeout

Conversation

@manja316
Copy link
Copy Markdown

Summary

  • Adds 5-second timeout via AbortController to registryValidation() fetch call
  • Switches from GET to HEAD for lightweight registry reachability check
  • Provides specific error message for timeout ("Registry URL timed out after 5s") vs generic network errors

Root Cause

fetch() in src/utils/generate/registry.ts had no timeout and no abort signal, causing the CLI to hang indefinitely when --registry-url points to an unreachable host (e.g., blackholed IP).

Test Plan

  • Tested with unreachable URL (http://10.255.255.1) — CLI now exits with timeout error after 5s
  • Tested with valid registry URL — works as before
  • Tested with 401 response — auth error still propagated correctly

Fixes #2027

When --registry-url points to an unreachable host, the CLI hangs
indefinitely because fetch() has no timeout and uses GET. This adds:
- 5-second timeout via AbortController
- HEAD method instead of GET for lightweight validation
- Specific error message for timeout vs other network errors

Fixes asyncapi#2027

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 21, 2026

⚠️ No Changeset found

Latest commit: 51f3aad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

[BUG] CLI hangs indefinitely when --registry-url points to an unreachable host (no timeout handling)

1 participant