@@ -16,7 +16,10 @@ import { actionDescription } from "./lib/command.js";
16
16
import { getDeploymentSelection } from "./lib/deploymentSelection.js" ;
17
17
import { isTryItOutDeployment } from "./lib/deployment.js" ;
18
18
import { loadDashboardConfig } from "./lib/localDeployment/filePaths.js" ;
19
- import { DEFAULT_LOCAL_DASHBOARD_API_PORT } from "./lib/localDeployment/dashboard.js" ;
19
+ import {
20
+ DEFAULT_LOCAL_DASHBOARD_API_PORT ,
21
+ checkIfDashboardIsRunning ,
22
+ } from "./lib/localDeployment/dashboard.js" ;
20
23
const DASHBOARD_HOST = process . env . CONVEX_PROVISION_HOST
21
24
? "http://localhost:6789"
22
25
: "https://dashboard.convex.dev" ;
@@ -55,17 +58,18 @@ export const dashboard = new Command("dashboard")
55
58
logWarning ( ctx , warningMessage ) ;
56
59
return ;
57
60
}
61
+ const isLocalDashboardRunning =
62
+ await checkIfDashboardIsRunning ( dashboardConfig ) ;
63
+ if ( ! isLocalDashboardRunning ) {
64
+ logWarning ( ctx , warningMessage ) ;
65
+ return ;
66
+ }
58
67
59
68
const queryString =
60
69
dashboardConfig . apiPort !== DEFAULT_LOCAL_DASHBOARD_API_PORT
61
70
? `?apiPort=${ dashboardConfig . apiPort } `
62
71
: "" ;
63
72
const dashboardUrl = `http://127.0.0.1:${ dashboardConfig . port } ${ queryString } ` ;
64
- const response = await fetch ( dashboardUrl ) ;
65
- if ( ! response . ok ) {
66
- logWarning ( ctx , warningMessage ) ;
67
- return ;
68
- }
69
73
await logOrOpenUrl ( ctx , dashboardUrl , options . open ) ;
70
74
return ;
71
75
}
0 commit comments