diff --git a/apps/web/ee/pages/workflows/[workflow].tsx b/apps/web/ee/pages/workflows/[workflow].tsx
index 7128dd08b92ee0..8da46fe82abf8a 100644
--- a/apps/web/ee/pages/workflows/[workflow].tsx
+++ b/apps/web/ee/pages/workflows/[workflow].tsx
@@ -78,6 +78,8 @@ function WorkflowPage() {
const {
data: workflow,
+ isError,
+ error,
isLoading,
dataUpdatedAt,
} = trpc.useQuery([
@@ -153,15 +155,21 @@ function WorkflowPage() {
) : (
<>
- {isAllDataLoaded ? (
-
+ {!isError ? (
+ <>
+ {isAllDataLoaded ? (
+
+ ) : (
+
+ )}
+ >
) : (
-
+
)}
>
)}
diff --git a/apps/web/server/routers/viewer/workflows.tsx b/apps/web/server/routers/viewer/workflows.tsx
index 1319b6f047cf84..b62793aa23d369 100644
--- a/apps/web/server/routers/viewer/workflows.tsx
+++ b/apps/web/server/routers/viewer/workflows.tsx
@@ -82,6 +82,11 @@ export const workflowsRouter = createProtectedRouter()
},
},
});
+ if (!workflow) {
+ throw new TRPCError({
+ code: "UNAUTHORIZED",
+ });
+ }
return workflow;
},
})