Closed amgno closed 2 weeks ago
Ok I fixed it, problem on my part. My bad But I keep getting this error when trying to upload an image:
Trying to host behind caddy and getting this:
nextjs-app_1 | [auth][error] UntrustedHost: Host must be trusted. URL was: https://myhostname/api/auth/session. Read more at https://errors.authjs.dev#untrustedhost
nextjs-app_1 | at h (/app/.next/server/chunks/6763.js:405:1241)
nextjs-app_1 | at c (/app/.next/server/chunks/6763.js:29:23635)
Evne tho the env variable is correct
When trying to login it sends me to: https://localhost:3000/admin/photos
Managed to get it to work, even if it redirects me to another page. Still now I'm getting "failed to fetch" when trying to upload an image
Everything works now. I'll leave what I did here since I don't really know how to use git
Dockerfile
FROM node
WORKDIR /app
RUN npm install -g pnpm
COPY . .
RUN pnpm install
EXPOSE 3000
RUN npm run build
CMD ["npm", "start"]
Docker-compose
version: '3.9'
services:
nextjs-app:
build:
context: .
dockerfile: Dockerfile
depends_on:
- postgres
volumes:
- .env:/app/.env
postgres:
image: 'postgres:latest'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- '5432:5432'
volumes:
- ./db:/var/lib/postgresql/data
networks:
caddy:
external: true
.dockerignore
db/**/*
db
db/*
.env
AUTH_TRUST_HOST=1
POSTGRES_URL=postgresql://postgres:postgres@dev.magno.me:5432/postgres
DISABLE_POSTGRES_SSL=1
Might be not optimized or efficient, I'm a beginner 🙌
Only thing that remains is the storage, i'm using cloudflare but I would love to use a selfhosted method. I'm no capable to do it myself tho. 😭
Not sure how a self-hosted image solution would work, especially given the constraints of next/image
. Closing for now, but linking to this issue in the FAQ in case there's more curiosity on the topic.
.env file:
Docker-compose file:
Dockerfile: