Hi, I am struggling to get the dashboard working. I have followed the documentation correctly and I ...
d
Hi, I am struggling to get the dashboard working. I have followed the documentation correctly and I am initing the dashboard in the recipe, however I just get to a not found when browsing to /auth/dashboard. I had this working once before be now when I have revisited this I just get this issue now.
r
hey @deviantdev can you enable backend debug logs and show the output when you query the dashboard path?
d
Sure
one sec
So this is what I am getting
its in docker
the server that is
is there a debug environment variable I need to use?
r
it's a boolean in the supertokens.init config on the backend
d
Cool I did add that but when. I got to the server api url which http://192.168.0.80:3567/auth/dashboard nothing is showing in the terminal
If I signin via the frontend then I get some logs flowing through
r
right. Whats your api base path config?
in appInfo
d
/api/auth
I have used that as well
r
right. So dashboard is on /api/auth/dashboard path
d
r
Do you see any debug logs?
can i see debug logs when you call any API?
and also your backend supertokens.init code
d
nothing is coming through
will paste now for you 🙂
so its seperated, I am using the nextjs template from supertokens
Copy code
supertokens.init(backendConfig());
Copy code
const port = process.env.APP_PORT || 3000;

const apiBasePath = "/api/auth/";

export const websiteDomain = process.env.APP_URL || process.env.NEXT_PUBLIC_APP_URL || `http://localhost:${port}`;

export const appInfo = {
    appName: "SuperTokens Demo App",
    websiteDomain,
    apiDomain: websiteDomain,
    apiBasePath,
};
Copy code
import ThirdPartyEmailPasswordNode from "supertokens-node/recipe/thirdpartyemailpassword";
import SessionNode from "supertokens-node/recipe/session";
import Dashboard from "supertokens-node/recipe/dashboard";
import UserRoles from "supertokens-node/recipe/userroles";
import { appInfo } from "./appInfo";
import { AuthConfig } from "../interfaces";

export let backendConfig = (): AuthConfig => {
  return {
    framework: "express",
    debug: true,
    supertokens: {
      // this is the location of the SuperTokens core.
      connectionURI: "http://192.168.0.80:3567",
    },
    appInfo,
    // recipeList contains all the modules that you want to
    // use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
    recipeList: [
      ThirdPartyEmailPasswordNode.init({
        providers: [
          // We have provided you with development keys which you can use for testing.
          // IMPORTANT: Please replace them with your own OAuth keys for production use.
          {
            config: {
              thirdPartyId: "google",
              clients: [
                {
                  clientId:
                    "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
                  clientSecret: "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",
                },
              ],
            },
          },
          {
            config: {
              thirdPartyId: "github",
              clients: [
                {
                  clientId: "467101b197249757c71f",
                  clientSecret: "e97051221f4b6426e8fe8d51486396703012f5bd",
                },
              ],
            },
          },
          {
            config: {
              thirdPartyId: "apple",
              clients: [
                {
                  clientId: "4398792-io.supertokens.example.service",
                  additionalConfig: {
                    keyId: "7M48Y4RYDL",
                    privateKey:
                      "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
                    teamId: "YWQCXGJRJL",
                  },
                },
              ],
            },
          },
          {
            config: {
              thirdPartyId: "twitter",
              clients: [
                {
                  clientId: "4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
                  clientSecret:
                    "BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC",
                },
              ],
            },
          },
        ],
      }),
      Dashboard.init(),
      SessionNode.init(),
      UserRoles.init(),
    ],
    isInServerlessEnv: true,
  };
};
Also for reference here is my docker compose file for the supertoken server instance
Copy code
version: '3'

services:
  # Note: If you are assigning a custom name to your db service on the line below, make sure it does not contain underscores
  db:
    image: 'postgres:latest'
    environment:
      POSTGRES_USER: supertokens_user 
      POSTGRES_PASSWORD: somePassword 
      POSTGRES_DB: supertokens
    ports:
      - 5432:5432
    networks:
      - app_network
    restart: unless-stopped
    healthcheck:
      test: ['CMD', 'pg_isready', '-U', 'supertokens_user', '-d', 'supertokens']
      interval: 5s
      timeout: 5s
      retries: 5

  supertokens:
    image: registry.supertokens.io/supertokens/supertokens-postgresql:7.0
    depends_on:
      db:
        condition: service_healthy
    ports:
      - 3567:3567
    environment:
      POSTGRESQL_CONNECTION_URI: "postgresql://supertokens_user:somePassword@db:5432/supertokens"
    networks:
      - app_network
    restart: unless-stopped
    healthcheck:
      test: >
        bash -c 'exec 3<>/dev/tcp/127.0.0.1/3567 && echo -e "GET /hello HTTP/1.1\r\nhost: 127.0.0.1:3567\r\nConnection: close\r\n\r\n" >&3 && cat <&3 | grep "Hello"'
      interval: 10s
      timeout: 5s
      retries: 5

networks:
  app_network:
    driver: bridge
I have destoryed this stack and re deployed it as well so everything is clean again
ummmmmm ok its working again
But why? I thought you are meant to go to the SuperToken API endpoint to get to the dashboard and not the frontend?
This takes me to the dashboard
Copy code
http://localhost:3000/api/auth/dashboard
And I was using
Copy code
http://192.168.0.80:3567/api/auth/dashboard
But literally in your documentation under viewing the dashboard it says to go to http://192.168.0.80:3567/api/auth/dashboard
r
right. So the dashboard is exposed via the backend sdk, not the supertokens core.
d
ok cool, thank you for your help tho, seems to be working just fine now
98 Views