500 : Converting circular structure to JSON #183

Closed
opened 2026-02-04 18:29:39 +03:00 by OVERLORD · 31 comments
Owner

Originally created by @n8jadams on GitHub (Aug 1, 2022).

I am trying to run Immich on my Unraid server using the official Portainer-CE app.
Once it's set up, I navigate to http://:2283, I see the favicon load and the body of the page shows the following error:

500
Converting circular structure to JSON
    --> starting at object with constructor 'Socket'
    |     property '_httpMessage' -> object with constructor 'ClientRequest'
    --- property 'socket' closes the circle
TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Socket'
    |     property '_httpMessage' -> object with constructor 'ClientRequest'
    --- property 'socket' closes the circle

docker-compose.yml

version: "3.8"

services:
  immich-server:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-server.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-microservices.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    image: altran1502/immich-machine-learning:release
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - database
    restart: always

  immich-web:
    image: altran1502/immich-web:release
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

  database:
    container_name: immich_postgres
    image: postgres:14
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

  immich-proxy:
    container_name: immich_proxy
    image: altran1502/immich-proxy:release
    ports:
      - 2283:80
    logging:
      driver: none
    depends_on:
      - immich-server
    restart: always

volumes:
  pgdata:

.env

DB_USERNAME=postgres
DB_PASSWORD=REDACTED
DB_DATABASE_NAME=immich
UPLOAD_LOCATION=/mnt/user/cloud-storage/app-configs/immich
JWT_SECRET=REDACTED
ENABLE_MAPBOX=false
VITE_SERVER_ENDPOINT=http://<my-ip>:2283/api

Task List

Please complete the task list below. We need this information to help us reproduce the bug or point out problems in your setup. You are not providing enough info may delay our effort to help you.

  • I have read thoroughly the README setup and installation instructions.
  • I have included my docker-compose file.
  • I have included my redacted .env file.
  • I have included information on my machine, and environment.
Originally created by @n8jadams on GitHub (Aug 1, 2022). I am trying to run Immich on my Unraid server using the official Portainer-CE app. Once it's set up, I navigate to http://<my-ip>:2283, I see the favicon load and the body of the page shows the following error: ``` 500 Converting circular structure to JSON --> starting at object with constructor 'Socket' | property '_httpMessage' -> object with constructor 'ClientRequest' --- property 'socket' closes the circle TypeError: Converting circular structure to JSON --> starting at object with constructor 'Socket' | property '_httpMessage' -> object with constructor 'ClientRequest' --- property 'socket' closes the circle ``` ## docker-compose.yml ```yml version: "3.8" services: immich-server: image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-server.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - .env environment: - NODE_ENV=production depends_on: - redis - database restart: always immich-microservices: image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-microservices.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - .env environment: - NODE_ENV=production depends_on: - redis - database restart: always immich-machine-learning: image: altran1502/immich-machine-learning:release entrypoint: ["/bin/sh", "./entrypoint.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - .env environment: - NODE_ENV=production depends_on: - database restart: always immich-web: image: altran1502/immich-web:release entrypoint: ["/bin/sh", "./entrypoint.sh"] env_file: - .env restart: always redis: container_name: immich_redis image: redis:6.2 restart: always database: container_name: immich_postgres image: postgres:14 env_file: - .env environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} PG_DATA: /var/lib/postgresql/data volumes: - pgdata:/var/lib/postgresql/data restart: always immich-proxy: container_name: immich_proxy image: altran1502/immich-proxy:release ports: - 2283:80 logging: driver: none depends_on: - immich-server restart: always volumes: pgdata: ``` ## .env ``` DB_USERNAME=postgres DB_PASSWORD=REDACTED DB_DATABASE_NAME=immich UPLOAD_LOCATION=/mnt/user/cloud-storage/app-configs/immich JWT_SECRET=REDACTED ENABLE_MAPBOX=false VITE_SERVER_ENDPOINT=http://<my-ip>:2283/api ``` **Task List** *Please complete the task list below. We need this information to help us reproduce the bug or point out problems in your setup. You are not providing enough info may delay our effort to help you.* - [x] I have read thoroughly the README setup and installation instructions. - [x] I have included my `docker-compose` file. - [x] I have included my redacted `.env` file. - [x] I have included information on my machine, and environment.
Author
Owner

@alextran1502 commented on GitHub (Aug 2, 2022):

Can you check what do you get from /api/server-info/ping?

Also do you have any firewall on? If so, can you allow port 2283?

@alextran1502 commented on GitHub (Aug 2, 2022): Can you check what do you get from `/api/server-info/ping`? Also do you have any firewall on? If so, can you allow port 2283?
Author
Owner

@n8jadams commented on GitHub (Aug 2, 2022):

I had forgotten to port forward 2283, but I got the same thing after doing that.

502 Bad Gateway
nginx error

@n8jadams commented on GitHub (Aug 2, 2022): I had forgotten to port forward 2283, but I got the same thing after doing that. 502 Bad Gateway nginx error
Author
Owner

@alextran1502 commented on GitHub (Aug 2, 2022):

Is your VITE_SERVER_ENDPOINT your local ip or external domain name?

@alextran1502 commented on GitHub (Aug 2, 2022): Is your `VITE_SERVER_ENDPOINT` your local ip or external domain name?
Author
Owner

@n8jadams commented on GitHub (Aug 2, 2022):

it is my public ip, should I make it my internal ip?

@n8jadams commented on GitHub (Aug 2, 2022): it is my public ip, should I make it my internal ip?
Author
Owner

@alextran1502 commented on GitHub (Aug 2, 2022):

If you try to access your instance over https://immich.yourdomain.com then your VITE_SERVER_ENDPOINT will need to be https://immich.yourdomain.com/api

@alextran1502 commented on GitHub (Aug 2, 2022): If you try to access your instance over `https://immich.yourdomain.com` then your `VITE_SERVER_ENDPOINT` will need to be `https://immich.yourdomain.com/api`
Author
Owner

@alextran1502 commented on GitHub (Aug 2, 2022):

And vice versa, if you access the site from your local IP, let's say http://192.168.1.50:2283 then your VITE_SERVER_ENDPOINT will be http://192.168.1.50:2283/api

@alextran1502 commented on GitHub (Aug 2, 2022): And vice versa, if you access the site from your local IP, let's say `http://192.168.1.50:2283` then your `VITE_SERVER_ENDPOINT` will be `http://192.168.1.50:2283/api`
Author
Owner

@alextran1502 commented on GitHub (Aug 3, 2022):

@n8jadams Hello, has this issue been resolved?

@alextran1502 commented on GitHub (Aug 3, 2022): @n8jadams Hello, has this issue been resolved?
Author
Owner

@n8jadams commented on GitHub (Aug 3, 2022):

The reason why I never responded was because I was setting up a domain name and https. But now I changed the VITE_SERVER_ENDPOINT to https://immich.mydomain.com/api and I'm getting the exact same error.

And at https://immich.mydomain.com/api/server-info/ping I'm getting the same 502 error.

@n8jadams commented on GitHub (Aug 3, 2022): The reason why I never responded was because I was setting up a domain name and https. But now I changed the VITE_SERVER_ENDPOINT to `https://immich.mydomain.com/api` and I'm getting the exact same error. And at `https://immich.mydomain.com/api/server-info/ping` I'm getting the same 502 error.
Author
Owner

@alextran1502 commented on GitHub (Aug 3, 2022):

what is your reverse proxy setup like?

@alextran1502 commented on GitHub (Aug 3, 2022): what is your reverse proxy setup like?
Author
Owner

@n8jadams commented on GitHub (Aug 3, 2022):

My domain points all requests (on all subdomains) to my public ip, my router forwards requests from 2283 to my private ip port 2283, and then nginx (nginx proxy manager) forwards requests from http://immich.mydomain.com to my public ip on port 2283...

@n8jadams commented on GitHub (Aug 3, 2022): My domain points all requests (on all subdomains) to my public ip, my router forwards requests from 2283 to my private ip port 2283, and then nginx (nginx proxy manager) forwards requests from `http://immich.mydomain.com` to my public ip on port 2283...
Author
Owner

@alextran1502 commented on GitHub (Aug 4, 2022):

I think what you will want to do is something similar to the setup below.

server {
  listen       80;
  server_name  immich.mydoamin.com;

  location / {
    proxy_pass  http://your-local-machine-ip-running-immich:2283;
  }
}
@alextran1502 commented on GitHub (Aug 4, 2022): I think what you will want to do is something similar to the setup below. ```nginx server { listen 80; server_name immich.mydoamin.com; location / { proxy_pass http://your-local-machine-ip-running-immich:2283; } } ```
Author
Owner

@spammads commented on GitHub (Aug 4, 2022):

Had the same issue.
Adding /photos to the url on client-side solved it:
http://immich.mydomain.com/photos

@spammads commented on GitHub (Aug 4, 2022): Had the same issue. Adding `/photos` to the url on client-side solved it: `http://immich.mydomain.com/photos`
Author
Owner

@rondadon commented on GitHub (Aug 4, 2022):

Had the same issue, all fresh install with docker-compose.
Tried to access the WebUI over http://IpAddressfromServer:2283 and got the message:

500

Converting circular structure to JSON
    --> starting at object with constructor 'ClientRequest'
    |     property 'socket' -> object with constructor 'Socket'
    --- property '_httpMessage' closes the circle

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'ClientRequest'
    |     property 'socket' -> object with constructor 'Socket'
    --- property '_httpMessage' closes the circle


As @CKranebitter pointed out: adding /photos after the port (http://IpAddressFromServer:2283/photos) redirected me to http://IpAddressFromServer:2283/auth/login and I was greeted with the login Page from immich.

But now I am greeted with the login page and not with the "Admin-User" creation page! So can not create admin account. Need to look which subfolder / path is used for the Admin Account creation.

So it seems, that the automatic redirection after creating the immich container(s) is not working properly.

@rondadon commented on GitHub (Aug 4, 2022): Had the same issue, all fresh install with docker-compose. Tried to access the WebUI over http://IpAddressfromServer:2283 and got the message: ``` 500 Converting circular structure to JSON --> starting at object with constructor 'ClientRequest' | property 'socket' -> object with constructor 'Socket' --- property '_httpMessage' closes the circle TypeError: Converting circular structure to JSON --> starting at object with constructor 'ClientRequest' | property 'socket' -> object with constructor 'Socket' --- property '_httpMessage' closes the circle ``` As @CKranebitter pointed out: adding /photos after the port (http://IpAddressFromServer:2283/photos) redirected me to http://IpAddressFromServer:2283/auth/login and I was greeted with the login Page from immich. But now I am greeted with the login page and not with the "Admin-User" creation page! So can not create admin account. Need to look which subfolder / path is used for the Admin Account creation. So it seems, that the automatic redirection after creating the immich container(s) is not working properly.
Author
Owner

@alextran1502 commented on GitHub (Aug 4, 2022):

@rondadon Can you share your .env file?

@alextran1502 commented on GitHub (Aug 4, 2022): @rondadon Can you share your `.env` file?
Author
Owner

@dnburgess commented on GitHub (Aug 4, 2022):

Just to jump in here, I'm using the default .env file. The only thing I've changed is the UPLOAD_LOCATION and the VITE_SERVER_ENDPOINT variables. The Upload Location is set to a folder on my system. For the Endpoint, I've tried my server's IP address as well as the FQDN.

I'm able to get to /photos and /auth/login, but not /auth/register

When I go to /auth/register, I get the same 500 errors as @rondadon

I've changed the :release tags to :latest to see if that fixes anything. It doesn't.

I'm using CloudFlare Tunnels for remote access. I'm on OMV 6 for testing purposes.

@dnburgess commented on GitHub (Aug 4, 2022): Just to jump in here, I'm using the default .env file. The only thing I've changed is the UPLOAD_LOCATION and the VITE_SERVER_ENDPOINT variables. The Upload Location is set to a folder on my system. For the Endpoint, I've tried my server's IP address as well as the FQDN. I'm able to get to /photos and /auth/login, but not /auth/register When I go to /auth/register, I get the same 500 errors as @rondadon I've changed the :release tags to :latest to see if that fixes anything. It doesn't. I'm using CloudFlare Tunnels for remote access. I'm on OMV 6 for testing purposes.
Author
Owner

@alextran1502 commented on GitHub (Aug 4, 2022):

@dnburgess
VITE_SERVER_ENDPOINT is usually the value that most get wrong, can you share yours? You shouldn't use the latest tag since it might not work properly, please use the release tag instead.

@alextran1502 commented on GitHub (Aug 4, 2022): @dnburgess `VITE_SERVER_ENDPOINT` is usually the value that most get wrong, can you share yours? You shouldn't use the `latest` tag since it might not work properly, please use the `release` tag instead.
Author
Owner

@alextran1502 commented on GitHub (Aug 4, 2022):

@dnburgess is your CloudFlare tunnel allow port 2283? I am not sure if you are accessing through a reverse proxy or direct access on port 2283. If you can share detailed information about your setting, having another pair of eyes to take a look at might spot something.

@alextran1502 commented on GitHub (Aug 4, 2022): @dnburgess is your CloudFlare tunnel allow port 2283? I am not sure if you are accessing through a reverse proxy or direct access on port 2283. If you can share detailed information about your setting, having another pair of eyes to take a look at might spot something.
Author
Owner

@dnburgess commented on GitHub (Aug 4, 2022):

@alextran1502 the Cloudflare tunnel points directly to http://192.168.1.65:2283.

My VITE_SERVER_ENDPOINT is https://photos.mysite.com/api

I've changed back to :release as :lastest was just testing to see if it fixed anything.

Strangely, as I write this, everything seems to have started working after switching back to :release.

I'm going to deploy this on another server for additional testing

@dnburgess commented on GitHub (Aug 4, 2022): @alextran1502 the Cloudflare tunnel points directly to http://192.168.1.65:2283. My VITE_SERVER_ENDPOINT is https://photos.mysite.com/api I've changed back to :release as :lastest was just testing to see if it fixed anything. Strangely, as I write this, everything seems to have started working after switching back to :release. I'm going to deploy this on another server for additional testing
Author
Owner

@alextran1502 commented on GitHub (Aug 4, 2022):

@dnburgess your VITE_SERVER_ENDPOINT should be http://192.168.1.65:2283/api

Edited: strange, it works?

@alextran1502 commented on GitHub (Aug 4, 2022): @dnburgess your `VITE_SERVER_ENDPOINT` should be `http://192.168.1.65:2283/api` Edited: strange, it works?
Author
Owner

@dnburgess commented on GitHub (Aug 4, 2022):

@alextran1502 in a previous comment you said this:

If you try to access your instance over https://immich.yourdomain.com then your VITE_SERVER_ENDPOINT will need to be https://immich.yourdomain.com/api

So that's what I did

@dnburgess commented on GitHub (Aug 4, 2022): @alextran1502 in a previous comment you said this: If you try to access your instance over https://immich.yourdomain.com then your VITE_SERVER_ENDPOINT will need to be https://immich.yourdomain.com/api So that's what I did
Author
Owner

@alextran1502 commented on GitHub (Aug 4, 2022):

@alextran1502 in a previous comment you said this:

If you try to access your instance over https://immich.yourdomain.com then your VITE_SERVER_ENDPOINT will need to be https://immich.yourdomain.com/api

So that's what I did

Ah so your CloudFlare tunnel is a reverse proxy that point your public domain https://photos.mysite.com to http://192.168.1.65:2283. Then this setup of VITE_SERVER_ENDPOINT=https://immich.yourdomain.com/api is correct

@alextran1502 commented on GitHub (Aug 4, 2022): > @alextran1502 in a previous comment you said this: > > If you try to access your instance over https://immich.yourdomain.com then your VITE_SERVER_ENDPOINT will need to be https://immich.yourdomain.com/api > > So that's what I did Ah so your CloudFlare tunnel is a reverse proxy that point your public domain `https://photos.mysite.com` to `http://192.168.1.65:2283`. Then this setup of `VITE_SERVER_ENDPOINT=https://immich.yourdomain.com/api` is correct
Author
Owner

@dnburgess commented on GitHub (Aug 5, 2022):

Just as an FYI: I spun up a new VM running Docker in Proxmox and everything came up exactly as one would expect and no issues, so I'm not sure what was going on, but everything on the new setup is working.

@dnburgess commented on GitHub (Aug 5, 2022): Just as an FYI: I spun up a new VM running Docker in Proxmox and everything came up exactly as one would expect and no issues, so I'm not sure what was going on, but everything on the new setup is working.
Author
Owner

@n8jadams commented on GitHub (Aug 5, 2022):

To follow up with this, I see the following

Screen Shot 2022-08-04 at 3 41 53 PM

I'm pretty sure I have the .env set up right.
Unless there's some trick to getting this to work with Portainer?

@n8jadams commented on GitHub (Aug 5, 2022): To follow up with this, I see the following <img width="1725" alt="Screen Shot 2022-08-04 at 3 41 53 PM" src="https://user-images.githubusercontent.com/24380612/182957922-92b72338-911f-4913-b5fc-6b79d1024016.png"> I'm pretty sure I have the .env set up right. Unless there's some trick to getting this to work with Portainer?
Author
Owner

@alextran1502 commented on GitHub (Aug 5, 2022):

To follow up with this, I see the following

Screen Shot 2022-08-04 at 3 41 53 PM

I'm pretty sure I have the .env set up right.

Unless there's some trick to getting this to work with Portainer?

Can you share the exact setup of yours?

@alextran1502 commented on GitHub (Aug 5, 2022): > To follow up with this, I see the following > > > > <img width="1725" alt="Screen Shot 2022-08-04 at 3 41 53 PM" src="https://user-images.githubusercontent.com/24380612/182957922-92b72338-911f-4913-b5fc-6b79d1024016.png"> > > > > I'm pretty sure I have the .env set up right. > > Unless there's some trick to getting this to work with Portainer? Can you share the exact setup of yours?
Author
Owner

@alextran1502 commented on GitHub (Aug 7, 2022):

@n8jadams There is a new release that is supposed to simplify the setup. Please try again and let me know if this issue is resolved. https://github.com/immich-app/immich/releases/tag/v1.20.0_30-dev

@alextran1502 commented on GitHub (Aug 7, 2022): @n8jadams There is a new release that is supposed to simplify the setup. Please try again and let me know if this issue is resolved. https://github.com/immich-app/immich/releases/tag/v1.20.0_30-dev
Author
Owner

@n8jadams commented on GitHub (Aug 10, 2022):

I think this is a step in the right direction.

Now the page loads initially and looks good and then the requests to https://immich.mydomain.com/api/user/me and https://immich.mydomain.com/api/user/count give a 502 response

(EDIT: The same applies from http://192.168.x.y:2283 and http://my-public-ip:2283)

@n8jadams commented on GitHub (Aug 10, 2022): I think this is a step in the right direction. Now the page loads initially and looks good and then the requests to `https://immich.mydomain.com/api/user/me` and `https://immich.mydomain.com/api/user/count` give a 502 response (EDIT: The same applies from `http://192.168.x.y:2283` and `http://my-public-ip:2283`)
Author
Owner

@panoti commented on GitHub (Aug 29, 2022):

Hi @n8jadams, are you still facing this error with the latest version?

@panoti commented on GitHub (Aug 29, 2022): Hi @n8jadams, are you still facing this error with the latest version?
Author
Owner

@Limezy commented on GitHub (Aug 31, 2022):

Hi, I have exactly the same problem :

"Circular error"
image

"AxiosError"
image

"login page"
image

I have to admit that my setup is not exactly standard, as I'm not running under docker but have compiled everything on Debian. I'm using a SSL certified url with a proxy pass through nginx to 0.0.0.0:3000 where the frontend is listening.
By the way, that would be great to have an option to set the vite server to listen to a chosen port.

EDIT : solved adding 127.0.0.1 immich-server to my /etc/hosts
However, I would still be interested to control the server and web ports

@Limezy commented on GitHub (Aug 31, 2022): Hi, I have exactly the same problem : * https://immich.mydomain.com leading to "AxiosError" (see below) after a request to /api/user/count * https://immich.mydomain.com/auth/register leading to "circular error" (see below) * https://immich.mydomain.com/albums or /photos redirecting to /auth/login * https://immich.mydomain.com/auth/login seems good but I don't have credentials * https://immich.mydomain.com/api/server-info/ping not found No errors found in the logs of immich microservices or immich machine learning. "Circular error" <img width="1075" alt="image" src="https://user-images.githubusercontent.com/24638389/187666650-6f135064-ae24-4d87-97c4-25ec832b92c8.png"> "AxiosError" <img width="1075" alt="image" src="https://user-images.githubusercontent.com/24638389/187666584-ded4f29b-9d66-4707-b72c-954b9b81c1b4.png"> "login page" <img width="1075" alt="image" src="https://user-images.githubusercontent.com/24638389/187667219-a6392099-c4a4-4de0-af15-7c6790260bff.png"> I have to admit that my setup is not exactly standard, as I'm not running under docker but have compiled everything on Debian. I'm using a SSL certified url with a proxy pass through nginx to 0.0.0.0:3000 where the frontend is listening. By the way, that would be great to have an option to set the vite server to listen to a chosen port. EDIT : solved adding `127.0.0.1 immich-server` to my `/etc/hosts` However, I would still be interested to control the server and web ports
Author
Owner

@panoti commented on GitHub (Sep 4, 2022):

Hi @Limezy, we stick heavily with docker, so there are some issues if you run outside docker. I hope immich team will support dockerless (maybe with pm2) soon.

@panoti commented on GitHub (Sep 4, 2022): Hi @Limezy, we stick heavily with docker, so there are some issues if you run outside docker. I hope immich team will support dockerless (maybe with `pm2`) soon.
Author
Owner

@Limezy commented on GitHub (Sep 5, 2022):

Thanks for your reply

@Limezy commented on GitHub (Sep 5, 2022): Thanks for your reply
Author
Owner

@alextran1502 commented on GitHub (Sep 28, 2022):

Close as not applicable anymore to the latest setup

@alextran1502 commented on GitHub (Sep 28, 2022): Close as not applicable anymore to the latest setup
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#183