varun-raj / immich-power-tools

Power tools for organizing your immich library
https://immich-power-tools.featureos.app/
267 stars 8 forks source link

TypeError [ERR_INVALID_URL]: Invalid URL #18

Closed Soulplayer closed 2 weeks ago

Soulplayer commented 2 weeks ago

Docker runs but when I go to the url I get: Request failed with status code 500

I see this in the logs:

⨯ TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:405:5)
    at new URL (node:internal/url:676:13)
    at parse (/app/node_modules/pg-connection-string/index.js:29:14)
    at new ConnectionParameters (/app/node_modules/pg/lib/connection-parameters.js:56:42)
    at new Client (/app/node_modules/pg/lib/client.js:18:33)
    at /app/.next/server/pages/api/analytics/exif/[property].js:1:1124 {
  input: 'postgresql://postgres-xxxxxx:xxxxxxx@immich_postgres:5432/immich',
  code: 'ERR_INVALID_URL'

Compose file:

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
                - compute
                - video
    volumes:
      - /mnt/user/afbeeldingen-immich:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - /mnt/user/afbeeldingen:/mnt/user/afbeeldingen
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-cuda
  # Note the lack of an `extends` section
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
                - compute
                - video
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:e3b17ba9479deec4b7d1eeec1548a253acc5374d68d3b27937fcfe4df8d18c7e
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    #volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      #- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    #healthcheck:
      #test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      #interval: 5m
      #start_interval: 30s
      #start_period: 5m
    command: ["postgres", "-c", "shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
    restart: always
    volumes:
      - pgdata:/var/lib/postgresql/data

  backup:
    container_name: immich_db_dumper
    image: prodrigestivill/postgres-backup-local
    env_file:
      - .env
    environment:
      POSTGRES_HOST: database
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      SCHEDULE: "@daily"
      BACKUP_DIR: /db_dumps
      BACKUP_KEEP_DAYS: 3
    volumes:
      - /mnt/user/appdata/backups/immich:/db_dumps
    depends_on:
      - database

  power-tools:
    container_name: immich_power_tools
    image: ghcr.io/varun-raj/immich-power-tools:latest
    ports:
      - "8401:3000"
    env_file:
      - .env

volumes:
  pgdata:
  model-cache:

.env file:

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/user/afbeeldingen-immich
# The location where your database files are stored
DB_DATA_LOCATION=./pgdata

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
TZ=Europe/Brussels

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=xxxxxxxxx

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres-xxxxx
DB_DATABASE_NAME=immich
#DB_HOSTNAME=immich_postgres

####################################################################################
#IMMICH_URL="http://10.0.3.3:2283/photos"
IMMICH_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
federicotravaini commented 2 weeks ago

Same here, the docker-compose looks just fine but the error i get is

Proxy error: TypeError: Failed to parse URL from immich_server/api/users/me
    at node:internal/deps/undici/undici:12618:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:405:5)
      at new URL (node:internal/url:676:13)
      at new Request (node:internal/deps/undici/undici:6108:25)
      at fetch (node:internal/deps/undici/undici:10396:25)
      at Object.fetch (node:internal/deps/undici/undici:12617:10)
      at fetch (node:internal/process/pre_execution:281:25)
      at p (/app/.next/server/pages/api/immich-proxy/[...path].js:1:639)
      at K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16859)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17492) {
    input: 'immich_server/api/users/me',
    code: 'ERR_INVALID_URL'
  }
}
hockeymachine86 commented 2 weeks ago

Same issue for me as well.

varun-raj commented 2 weeks ago

Hi @Soulplayer, Thanks for reporting this,

We've updated a new version, can you please check in that?

Soulplayer commented 2 weeks ago

Still seeing the same kind of errors.

sai80082 commented 2 weeks ago

Hey @Soulplayer. In your case its an error related to database connection string. Do you have any special characters in your DB_USERNAME and DB_PASSWORD?

Soulplayer commented 2 weeks ago

Yes. In the db_password. I’ll look into changing the password.

sai80082 commented 2 weeks ago

@federicotravaini and @hockeymachine86 is the problem resolved?

federicotravaini commented 2 weeks ago

@federicotravaini and @hockeymachine86 is the problem resolved?

I was able to fix it doing 2 things:

hockeymachine86 commented 2 weeks ago

@federicotravaini and @hockeymachine86 is the problem resolved?

Can confirm it works, but it requires you add IMMICH_URL=http://192.168.x.yyy:2283 in the .env (the address for immich server) as mentioned by @federicotravaini

Any chance for smart merge to let you select more than 5 at a time and then it would just run the 5 at a time?

varun-raj commented 2 weeks ago

Any chance for smart merge to let you select more than 5 at a time and then it would just run the 5 at a time?

Yes! That's the next thing I'll be working on :)

varun-raj commented 2 weeks ago

Since it started working for everyone we can mark it is done right?

hockeymachine86 commented 2 weeks ago

Yep

On Sun, Aug 25, 2024, 12:10 PM Varun Raj Manoharan @.***> wrote:

Since it started working for everyone we can mark it is done right?

— Reply to this email directly, view it on GitHub https://github.com/varun-raj/immich-power-tools/issues/18#issuecomment-2308928155, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJGE6Q6OKPXW72MSZMBGO3ZTIFYJAVCNFSM6AAAAABNBTPN7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYHEZDQMJVGU . You are receiving this because you were mentioned.Message ID: @.***>