Search before asking
Pake version
3.1.1
System version
macOS 14
Node.js version
22.2.0
Minimal reproduce step
- Ensure a network hostname (e.g.,
gateway or pihole) is resolvable via system DNS or /etc/hosts
- Attempt to build a pake app using the CLI:
pake http://gateway --name GatewayApp
- Observe the error:
command-argument value 'http://gateway' is invalid for argument 'url'. Your url "http://gateway" is invalid
What did you expect to see?
Pake should accept any hostname that the system can resolve, including:
- Network hostnames without TLD (e.g.,
gateway, router, nas)
- mDNS addresses (e.g.,
printer.local)
- Docker container names (e.g.,
web-server)
- Kubernetes service names (e.g.,
api-service)
- Any syntactically valid URL that follows web standards
The CLI should proceed with building the app for the specified hostname.
What did you see instead?
The CLI rejects the hostname with a validation error: "Your url "http://gateway" is invalid", blocking the build completely.
This happens even when the hostname is perfectly valid and resolvable by the system.
Anything else?
Root Cause:
The issue is in bin/utils/url.ts in the normalizeUrl function. It uses the is-url package which has overly restrictive validation rules that only accept localhost or hostnames with traditional TLDs.
Proposed Solution:
Replace the is-url dependency with JavaScript's built-in URL constructor:
// Current problematic code
if (isUrl(urlWithProtocol)) {
return urlWithProtocol;
}
// Proposed fix
try {
new URL(urlWithProtocol);
return urlWithProtocol;
} catch (err) {
throw new Error(`Your url "${urlWithProtocol}" is invalid: ${(err as Error).message}`);
}
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
Search before asking
I searched in the issues and found nothing similar.
Pake version
3.1.1
System version
macOS 14
Node.js version
22.2.0
Minimal reproduce step
gatewayorpihole) is resolvable via system DNS or /etc/hostspake http://gateway --name GatewayAppcommand-argument value 'http://gateway' is invalid for argument 'url'. Your url "http://gateway" is invalidWhat did you expect to see?
Pake should accept any hostname that the system can resolve, including:
gateway,router,nas)printer.local)web-server)api-service)The CLI should proceed with building the app for the specified hostname.
What did you see instead?
The CLI rejects the hostname with a validation error: "Your url "http://gateway" is invalid", blocking the build completely.
This happens even when the hostname is perfectly valid and resolvable by the system.
Anything else?
Root Cause:
The issue is in
bin/utils/url.tsin thenormalizeUrlfunction. It uses theis-urlpackage which has overly restrictive validation rules that only acceptlocalhostor hostnames with traditional TLDs.Proposed Solution:
Replace the
is-urldependency with JavaScript's built-inURLconstructor: