SurfSense icon indicating copy to clipboard operation
SurfSense copied to clipboard

Can't setup local username/password with Surfsense

Open zono50 opened this issue 4 months ago • 17 comments

Not sure what i'm doing wrong, but i don't see any option anywhere to sign up or register. It just asks me to sign in with an email and password.

Image Image

zono50 avatar Aug 17 '25 10:08 zono50

Hi @zono50 , You should be able to register at '/register' path. Many users get confused here I will add some info to this login page.

MODSetter avatar Aug 17 '25 16:08 MODSetter

New user here. I am running into the same problem, but the "/register" path kicks me back to the "/login" path immediately. PgAdmin server was setup as per instruction, not sure what I am doing wrong.

JerGag avatar Aug 25 '25 21:08 JerGag

New user here. I am running into the same problem, but the "/register" path kicks me back to the "/login" path immediately. PgAdmin server was setup as per instruction, not sure what I am doing wrong.

Make sure you have this .env as LOCAL : https://github.com/MODSetter/SurfSense/blob/fe0cabea72e557e85d066fcf1c936a091a39fb4b/surfsense_web/.env.example#L2

MODSetter avatar Aug 25 '25 21:08 MODSetter

Oh thank you, it works now !

JerGag avatar Aug 25 '25 22:08 JerGag

I got everything setup but when I try to register, I get this error:

Image

(I used the "Register here" link to reach this page)

kanwarplaha avatar Aug 31 '25 11:08 kanwarplaha

Okay, so the issue was (perhaps) that uvicorn hadn't started up yet. Now it works and I could register and login. However, I also changed the following from "localhost" to IP address of my docker host:

NEXT_PUBLIC_FASTAPI_BACKEND_URL

Backing up .env and docker-compose files now!

kanwarplaha avatar Sep 01 '25 02:09 kanwarplaha

Okay, so the issue was (perhaps) that uvicorn hadn't started up yet. Now it works and I could register and login. However, I also changed the following from "localhost" to IP address of my docker host:

NEXT_PUBLIC_FASTAPI_BACKEND_URL

Backing up .env and docker-compose files now!

Thank you - just to confirm, I had to change this as well... I've been pulling my hair out for the past 2 hours on this, I appreciate development is difficult, but the logging and error reporting on this app is abysmal..

projx avatar Oct 08 '25 17:10 projx

Set the NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE=LOCAL on root and frontend .env, but still when i want to go to /register it kicks me back to /login. In the backend i set AUTH_TYPE to LOCAL and REGISTATION_ENABLED = TRUE

Acharab avatar Nov 02 '25 11:11 Acharab

@Acharab I also encountered the same issue. Do you know how to fix this?

Yinnnn94 avatar Nov 03 '25 06:11 Yinnnn94

@Yinnnn94 I did not, you could hash a password and add it in the DB, but that a little too mutch for me.

Acharab avatar Nov 03 '25 06:11 Acharab

@Acharab @Yinnnn94 It should work after you set that var. If you are using docker make sure this var https://github.com/MODSetter/SurfSense/blob/57fd82f17f8ca21d8a65adfd10e300b705373d63/.env.example#L10 is also LOCAL

MODSetter avatar Nov 03 '25 19:11 MODSetter

@MODSetter Hi, thanks for sharing this project! I was able to reach the registration page successfully. However, when I entered my email address and password, I got the following error message:

Login failed  
An unexpected error occurred. Please try again  

Here’s what I’ve tried so far:

  • Changed localhost to the Docker host IP (as @kanwarplaha mentioned).
  • Upgraded the image (following this issue).

Despite these changes, the error still persists. Do you have any idea how to fix this?

Yinnnn94 avatar Nov 04 '25 01:11 Yinnnn94

@MODSetter Umm, it suddenly worked — I was able to sign up successfully! 😅

I didn’t change anything else, so I’m not exactly sure what fixed it. Maybe the service just needed some time to start up properly.

Anyway, it’s working now — thanks for your help!

Yinnnn94 avatar Nov 04 '25 01:11 Yinnnn94

@MODSetter hey! I have the same issue, I made sure in all the .env files I got LOCAL and registration set to true. Still have all the issues above, I can't go to the /register endpoint as it redirects me to the login page. in the login page I see

Login failed  
An unexpected error occurred. Please try again  

Also, I saw the in the docker dashboard there's the backend image which is not starting as

exec /app/scripts/docker/entrypoint.sh: no such file or directory

even tho the entrypoint.sh file exists.

I have no clue what to do. Thanks in advance

theDoz12 avatar Nov 11 '25 22:11 theDoz12

@theDoz12 @projx @Acharab @Yinnnn94

The code checks process.env.NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE and defaults to "GOOGLE" if not found:

  const authType = process.env.NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE || "GOOGLE";
  if (authType !== "LOCAL") {
      router.push("/login");
  }

The problem is that process.env in client-side Next.js code only contains environment variables that were available at build time, not at runtime. Even though the Docker container has NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE=LOCAL set, if the frontend was built before this variable was set, it won't be available.

To fix this, you need to rebuild the frontend container:

cd SurfSense
docker compose down
docker compose build
docker compose up -d

MatMercer avatar Nov 16 '25 22:11 MatMercer

Same problem here... going to the registration URL bumps me back to login url. ; have tried all these steps (modified .env file, replaced localhost with container ip, rebuilt container) and still having the same problem

edit: rebuilt the container again and now it will stay on the registration page. However, it gives me "Login failed An unexpected error occurred. Please try again" on every attempt

pdennis avatar Nov 17 '25 22:11 pdennis

same error here

jamdart avatar Nov 25 '25 00:11 jamdart

Similar issues when I try to run Surfsense.

I think in general the application's parsing of the env vars seems a bit flaky, it doesn't seem to respect the environment variables that set the auth to LOCAL, it always seems to offer 'Continue with Google' and no local login issue, even after blowing everything away and starting fresh.

NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE=LOCAL
AUTH_TYPE=LOCAL
REGISTRATION_ENABLED=TRUE
Image

sammcj avatar Dec 03 '25 21:12 sammcj