Skip to content

fix: add timeout to registry URL validation to prevent indefinite hangs (fixes #2027)#2042

Open
chengfei-gh wants to merge 1 commit intoasyncapi:masterfrom
chengfei-gh:fix/registry-timeout-2027
Open

fix: add timeout to registry URL validation to prevent indefinite hangs (fixes #2027)#2042
chengfei-gh wants to merge 1 commit intoasyncapi:masterfrom
chengfei-gh:fix/registry-timeout-2027

Conversation

@chengfei-gh
Copy link

Problem

When --registry-url points to an unreachable host, the CLI hangs indefinitely.

Solution

Added AbortController with 10s timeout to registryValidation().

See #2027.

Adds AbortController-based timeout (10s) to registryValidation() in
src/utils/generate/registry.ts. Previously, when --registry-url pointed
to an unreachable host, the CLI would hang indefinitely.

Changes:
- Use AbortController with 10s timeout
- Switch from GET to HEAD for lighter validation
- Properly handle AbortError with descriptive message
- Clean up timeout in finally block

Fixes asyncapi#2027
@changeset-bot
Copy link

changeset-bot bot commented Mar 16, 2026

⚠️ No Changeset found

Latest commit: 9beee93

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

@sonarqubecloud
Copy link

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.

1 participant