fix: add timeout handling for registry URL validation#2074
fix: add timeout handling for registry URL validation#2074HuiNeng6 wants to merge 1 commit intoasyncapi:masterfrom
Conversation
Fixes asyncapi#2027 - Add 5-second timeout using AbortController to prevent CLI hanging - Use HEAD request instead of GET for lightweight connectivity check - Provide meaningful error messages for timeout and network errors - Add comprehensive unit tests for the fix Previously, when --registry-url pointed to an unreachable host, the CLI would hang indefinitely. Now it fails fast with a clear error message.
|
There was a problem hiding this comment.
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.
|



Description
Fixes #2027
This PR adds timeout handling to prevent the CLI from hanging indefinitely when --registry-url\ points to an unreachable host.
Changes
Before (Bug)
When running:
\\�ash
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template --registry-url http://10.255.255.1
\\
The CLI would hang indefinitely with no feedback.
After (Fixed)
Now the CLI fails fast with a clear error message:
\
Error: Registry URL validation timed out after 5 seconds. Could not reach: http://10.255.255.1. Please check if the URL is correct and the server is accessible.
\\
Testing
Related Issue
Fixes #2027