Skip to content

Commit 41d6b23

Browse files
sshaderConvex, Inc.
authored andcommitted
Log to sentry from dashboard on disconnected WS (#34592)
We've gotten some reports of folks being unable to connect to their deployments, but we generally can't investigate much until we have an instance name. This should log a message to Sentry whenever the WS is disconnected in the dashboard including the instance name. If the developer is completely offline (e.g. bad wifi), logging to sentry won't work either, so hopefully this'll catch issues specific to connecting to Convex. If this doesn't have too many false positives, we can later change this to display UI to the developer indicating we're having trouble connecting + any actionable instructions (e.g. filing a bug report, running a network test) GitOrigin-RevId: c114735ee9c400409f3380b4b2173d73e62f7519
1 parent b4eb450 commit 41d6b23

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

npm-packages/dashboard-common/src/lib/deploymentContext.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ function DeploymentWithConnectionState({
345345
deployment: ConnectedDeployment;
346346
children: ReactNode;
347347
}) {
348-
const { isSelfHosted } = useContext(DeploymentInfoContext);
348+
const { isSelfHosted, captureMessage } = useContext(DeploymentInfoContext);
349349
const { client, deploymentUrl, deploymentName } = deployment;
350350
const [connectionState, setConnectionState] = useState<
351351
"Connected" | "Disconnected" | "LocalDeploymentMismatch" | null
@@ -395,6 +395,12 @@ function DeploymentWithConnectionState({
395395
}, 5000);
396396
return () => clearInterval(checkConnection);
397397
});
398+
useEffect(() => {
399+
if (isDisconnected && !deploymentName.startsWith("local-")) {
400+
// Log to sentry including the instance name when we seem to be unable to connect to a cloud deployment
401+
captureMessage(`Cloud deployment is disconnected: ${deploymentName}`);
402+
}
403+
}, [isDisconnected, deploymentName, captureMessage]);
398404
const value = useMemo(
399405
() => ({
400406
deployment,

0 commit comments

Comments
 (0)