Skip to content

Commit 5dc12d6

Browse files
fix: fail immediately when --url is unreachable instead of 60s timeout @W-21331028@ (#31)
- When --url is provided and unreachable, fail immediately with clear error - Add error.dev-url-unreachable-with-flag message for --url case - Suggests removing --url to use dev.command when user has manifest config
1 parent 321ac72 commit 5dc12d6

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

messages/webapp.dev.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ Failed to watch manifest: %s
176176
Dev server unreachable at %s.
177177
Start your dev server manually at that URL, or add dev.command to webapplication.json to start it automatically.
178178

179+
# error.dev-url-unreachable-with-flag
180+
181+
Dev server unreachable at %s.
182+
Remove --url to use dev.command to start the server automatically, or ensure your dev server is running at that URL.
183+
179184
# error.port-in-use
180185

181186
Port %s is already in use. Try specifying a different port with the --port flag or stopping the service that's using the port.

src/commands/webapp/dev.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,15 @@ export default class WebappDev extends SfCommand<WebAppDevResult> {
288288
devServerUrl = resolvedUrl;
289289
this.log(messages.getMessage('info.url-already-available', [resolvedUrl]));
290290
this.logger.debug(`URL ${resolvedUrl} is reachable, skipping dev server startup`);
291-
} else if ((flags.url ?? manifest?.dev?.url) && !manifest?.dev?.command?.trim()) {
292-
// Explicit URL (--url or dev.url) but no dev.command - don't start (we can't control the port)
291+
} else if (flags.url) {
292+
// User explicitly passed --url; assume server is already running at that URL
293+
// Fail immediately if unreachable (don't start dev server)
294+
throw new SfError(messages.getMessage('error.dev-url-unreachable-with-flag', [resolvedUrl]), 'DevServerUrlError', [
295+
`Ensure your dev server is running at ${resolvedUrl}`,
296+
'Remove --url to use dev.command to start the server automatically',
297+
]);
298+
} else if (manifest?.dev?.url && !manifest?.dev?.command?.trim()) {
299+
// dev.url in manifest but no dev.command - don't start (we can't control the port)
293300
throw new SfError(messages.getMessage('error.dev-url-unreachable', [resolvedUrl]), 'DevServerUrlError', [
294301
`Ensure your dev server is running at ${resolvedUrl}`,
295302
'Or add dev.command to webapplication.json to start it automatically',

0 commit comments

Comments
 (0)