#issue accessing the dashboard's login page hosted on shared hosting service

12 messages · Page 1 of 1 (latest)

timid dew
#

the websites domain is

https://www.rekangroup.com

the error i get on console is

GET https://rekangroup.com/dashboard/login?callbackUrl=%2Fdashboard 500 (Internal Server Error)
Navigated to https://rekangroup.com/dashboard/login?callbackUrl=%2Fdashboard

it works with no problem in locally but on the hosting service this is what i face im kinda hopless and need some help please.

delicate socketBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

timid dew
#

this is the files i feel like might be connected

 server.js
/* eslint-disable @typescript-eslint/no-require-imports */
const next = require('next');
const express = require('express');

const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();

app.prepare().then(() => {
  const server = express();

  // Set NEXTAUTH_URL dynamically
  server.use((req, res, next) => {
    if (!process.env.NEXTAUTH_URL) {
      process.env.NEXTAUTH_URL = dev
        ? 'http://localhost:3000'
        : `https://${req.headers.host}`;
    }
    next();
  });

  server.all('*', (req, res) => {
    return handle(req, res);
  });

  const port = process.env.PORT || 3000;
  server.listen(port, (err) => {
    if (err) throw err;
    console.log(`> Ready on http://localhost:${port}`);
  });
}).catch((err) => {
  console.error('Error starting server:', err);
  process.exit(1);
});
#

.

 middleware.ts
//Src/middleware.ts
import { withAuth } from "next-auth/middleware";

export default withAuth({
  callbacks: {
    authorized: ({ token, req }) => {

      // Let login page be public
      if (req.nextUrl.pathname === "/dashboard/login") {
        return true;
      }
      // Otherwise require a valid session
      return !!token;
    },
  },
  pages: {
    signIn: "/dashboard/login",
  },
});

export const config = {
  matcher: [
    "/dashboard/:path*",
    "/api/admin/:path*",
  ],
};
neon pebble
#

check the server console

#

it will show you the errors

#

@timid dew

timid dew
#

The error is the same as shown on the image and the provided error i gave on the posts description

#

Im not sure where to look for the error as to add debugs, but now i think about it it could be that the dashboard route is not recognised or misgonfigured from the middleware

timid dew
neon pebble
#

Send screen