origranot / reduced.to

Free Modern URL Reducer. Make sure to share love by giving it a star.🌟 Have a great day!
https://reduced.to
MIT License
687 stars 282 forks source link

Cannot create new users #654

Closed davidgs closed 10 months ago

davidgs commented 10 months ago

Description

I'm self-hosting at https://dgs.st/ (I am reverse-proxying that to the app) and whenever I attempt to create a new user, I get:

[Nest] 1433835  - 01/01/2024, 6:08:09 PM   ERROR [ExceptionsHandler] Request failed with status code 401
AxiosError: Request failed with status code 401
    at settle (/srv/reduced.to/node_modules/axios/lib/core/settle.js:19:12)
    at IncomingMessage.handleStreamEnd (/srv/reduced.to/node_modules/axios/lib/adapters/http.js:585:11)
    at IncomingMessage.emit (node:events:531:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

The docs are really light on what I need to do regarding most of the config options (Do I need Redis in order to create accounts? etc.) so I'm unsure how to track this down.

Screenshots

No response

Additional information

.env file:

/srv/reduced.to # cat !$
cat .env
# General
BACKEND_APP_PORT=3000
FRONTEND_APP_PORT=5000
TRACKER_APP_PORT=3001
NODE_ENV=production

# RATE LIMIT
RATE_LIMIT_TTL=60
RATE_LIMIT_COUNT=100

# LOGGER
LOGGER_CONSOLE_THRESHOLD=DEBUG #, INFO, WARN, ERROR, FATAL

# FRONTEND
DOMAIN=localhost
CLIENTSIDE_API_DOMAIN=http://localhost:3000 # Use this verible, while making client side API calls
API_DOMAIN=http://localhost:3000 # If you are running with docker compose change this to http://backend:3000
STORAGE_DOMAIN=Get it from https://cloud.digitalocean.com/spaces

# DATABASE
# If you are running with docker compose change host to postgres
DATABASE_URL="postgresql://postgres:********@localhost:5432/reduced_to_db?schema=public"

# REDIS
REDIS_ENABLE=false
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=password
REDIS_TTL=1800  # 30 minutes in seconds (default ttl)

# NOVU - You don't need this when running locally (just verify your email from the database)
NOVU_API_KEY=Get it from https://novu.co/

# MEMPHIS (Event streaming service)
MEMPHIS_ENABLE=false # Set this to true if you want to use the event streaming service
MEMPHIS_HOST=Get it from https://memphis.dev/
MEMPHIS_USERNAME=Get it from https://memphis.dev/
MEMPHIS_PASSWORD=Get it from https://memphis.dev/
MEMPHIS_ACCOUNT_ID=Get it from https://memphis.dev/

# AUTH
AUTH_JWT_ACCESS_SECRET=fortheloveofallthatsholy
AUTH_JWT_REFRESH_SECRET=areyoufuckingkiddingme

AUTH_GOOGLE_CLIENT_ID=Get it from https://console.cloud.google.com/apis/credentials
AUTH_GOOGLE_CLIENT_SECRET=Get it from https://console.cloud.google.com/apis/credentials

# TRACKER
TRACKER_STATS_QUEUE_NAME=stats

# STORAGE
STORAGE_ENABLE=false
STORAGE_ENDPOINT=Get it from https://cloud.digitalocean.com/spaces
STORAGE_ACCESS_KEY=Get it from https://cloud.digitalocean.com/spaces
STORAGE_SECRET_KEY=Get it from https://cloud.digitalocean.com/spaces
STORAGE_BUCKET_NAME=Get it from https://cloud.digitalocean.com/spaces
origranot commented 10 months ago

@davidgs hey!

First, I am so happy to see you are self hosting!

Make sure you change the following configuration to use docker network and not localhost, there are comments above them.

API_DOMAIN DATABASE_URL

In addition, make sure you are using the real domain name under: CLIENTSIDE_API_DOMAIN

p.s, make sure you rebuild the frontend image and not using the official 'reduced.to' image. This is crucial in-order to change the frontend variables (they are being assigned in build time)

If you still encounter errors, I will be more than happy to assist you in Discord. You can give me your discord and I will add you.

Have a great day!

davidgs commented 10 months ago

I'm not using Docker to deploy. I'm just deploying straight from the code.

I guess if I'm behind a proxy, I will have to proxy port 3000? I need it all to run over TLS, and I'd also like to limit account creation so not just anyone can use my shortener!

My Discord handle is davidgs

Thanks!

origranot commented 10 months ago

I'm not using Docker to deploy. I'm just deploying straight from the code.

I guess if I'm behind a proxy, I will have to proxy port 3000? I need it all to run over TLS, and I'd also like to limit account creation so not just anyone can use my shortener!

My Discord handle is davidgs

Thanks!

Added you on Discord.

Atm we don't have limitation on user creation as it's not planned, you would have to implement it by yourself.

davidgs commented 10 months ago

I never got a discord invite. you could email it to me at davidgs@davidgs.com maybe?

Avior95 commented 10 months ago

Hi, I have the same problem, I followed your instructions step by step, and still something is not working properly, I would appreciate it if you could guide me @origranot
Have a great day!

origranot commented 10 months ago

Hi, I have the same problem, I followed your instructions step by step, and still something is not working properly, I would appreciate it if you could guide me @origranot Have a great day!

Hey @Avior95, let's connect! Drop down your discord or email me at oriorigranot@gmail.com. Have a great day!

davidgs commented 10 months ago

We are connected on Discord now, can you invite me to the reduced.to server please?

origranot commented 10 months ago

We are connected on Discord now, can you invite me to the reduced.to server please?

https://discord.gg/A4StpF76SU

Avior95 commented 10 months ago

avior9515 :) @origranot Shabbat shalom

origranot commented 10 months ago

We continue this conversation over at Discord.