Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix: Unable to login after deleting all projects

Neeraj138eebe3c164a78
diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx
index 1ac570f71f..6c4483d499 100644
--- a/frontend/src/pages/dashboard/[id].tsx
+++ b/frontend/src/pages/dashboard/[id].tsx
@@ -219,8 +219,7 @@ export default function Dashboard() {
(async () => {
if (router.isReady && workspaceId === 'undefined') {
router.push('/noprojects');
- }
- try {
+ } else try {
const { push, query } = router
const tempNumSnapshots = await getProjectSercetSnapshotsCount({
workspaceId
diff --git a/frontend/src/pages/login.tsx b/frontend/src/pages/login.tsx
index ec0dbaebb9..64f1caca5a 100644
--- a/frontend/src/pages/login.tsx
+++ b/frontend/src/pages/login.tsx
@@ -33,7 +33,7 @@ export default function Login() {
let userWorkspace;
try {
const userWorkspaces = await getWorkspaces();
- userWorkspace = userWorkspaces[0]._id;
+ userWorkspace = userWorkspaces[0] && userWorkspaces[0]._id;
router.push(`/dashboard/${userWorkspace}`);
} catch (error) {
console.log('Error - Not logged in yet');