Request failed with status code 502 #254

Closed
opened 2026-02-04 19:04:15 +03:00 by OVERLORD · 25 comments
Owner

Originally created by @ajoshuasmith on GitHub (Sep 7, 2022).

I upgraded to the latest version v1.27.0_37-dev from v1.26.0_36-dev and I received this error when accessing the GUI.

Any potential troubleshooting steps that I can follow?

Error code 500
Request failed with status code 502
Verbose

Request failed with status code 502,AxiosError,ERR_BAD_RESPONSE,[object Object],[object XMLHttpRequest],[object Object]
Originally created by @ajoshuasmith on GitHub (Sep 7, 2022). I upgraded to the latest version `v1.27.0_37-dev` from `v1.26.0_36-dev` and I received this error when accessing the GUI. Any potential troubleshooting steps that I can follow? ``` Error code 500 Request failed with status code 502 Verbose Request failed with status code 502,AxiosError,ERR_BAD_RESPONSE,[object Object],[object XMLHttpRequest],[object Object] ```
Author
Owner

@bo0tzz commented on GitHub (Sep 7, 2022):

Try clearing your cookies/site data. I believe this may be a cached version of the frontend you're getting.

@bo0tzz commented on GitHub (Sep 7, 2022): Try clearing your cookies/site data. I believe this may be a cached version of the frontend you're getting.
Author
Owner

@ajoshuasmith commented on GitHub (Sep 7, 2022):

I tried another browser and cleared

image

@ajoshuasmith commented on GitHub (Sep 7, 2022): I tried another browser and cleared ![image](https://user-images.githubusercontent.com/78829059/188760761-365f00b4-3f5f-47d8-a834-c33476c2b3b1.png)
Author
Owner

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

Please provide the requested info so we can help you troubleshoot

@alextran1502 commented on GitHub (Sep 7, 2022): Please provide the requested info so we can help you troubleshoot
Author
Owner

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

Can you also the server log and the microservices log?

@alextran1502 commented on GitHub (Sep 7, 2022): Can you also the server log and the microservices log?
Author
Owner

@ajoshuasmith commented on GitHub (Sep 7, 2022):

Ubuntu 20.04 VM running via Unraid
docker-compose is not modified from what is provided.
Custom .env -
env.txt

Apologies for my ignorance - could you let me know where those logs would be located?

Thank you sir!

@ajoshuasmith commented on GitHub (Sep 7, 2022): Ubuntu 20.04 VM running via Unraid docker-compose is not modified from what is provided. Custom .env - [env.txt](https://github.com/immich-app/immich/files/9501642/env.txt) Apologies for my ignorance - could you let me know where those logs would be located? Thank you sir!
Author
Owner

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

You can do docker logs <container-name> :)

@alextran1502 commented on GitHub (Sep 7, 2022): You can do `docker logs <container-name>` :)
Author
Owner

@ajoshuasmith commented on GitHub (Sep 7, 2022):

Now that is simple :D
microservices log.txt

server logs.txt

@ajoshuasmith commented on GitHub (Sep 7, 2022): Now that is simple :D [microservices log.txt](https://github.com/immich-app/immich/files/9505688/microservices.log.txt) [server logs.txt](https://github.com/immich-app/immich/files/9505671/server.logs.txt)
Author
Owner

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

Ok I will need the database logs as well. Those containers cannot connect to the database, I think there is a database migration issue.

Did you use any tag in your docker-compose file other than release?

@alextran1502 commented on GitHub (Sep 7, 2022): Ok I will need the database logs as well. Those containers cannot connect to the database, I think there is a database migration issue. Did you use any tag in your docker-compose file other than `release`?
Author
Owner

@ajoshuasmith commented on GitHub (Sep 7, 2022):

I don't believe so - everything defaulted.

immich postgres.txt

@ajoshuasmith commented on GitHub (Sep 7, 2022): I don't believe so - everything defaulted. [immich postgres.txt](https://github.com/immich-app/immich/files/9505751/immich.postgres.txt)
Author
Owner

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

Hmm somehow you have no space left on the device

2022-09-07 10:43:40.469 UTC [1] FATAL: could not write lock file "postmaster.pid": No space left on device

@alextran1502 commented on GitHub (Sep 7, 2022): Hmm somehow you have no space left on the device `2022-09-07 10:43:40.469 UTC [1] FATAL: could not write lock file "postmaster.pid": No space left on device`
Author
Owner

@meichthys commented on GitHub (Sep 8, 2022):

I'm also seeing this when deploying via docker-compose:
image

Here's the logs in microservices:

[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [NestFactory] Starting Nest application...
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] DatabaseModule dependencies initialized +47ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] JwtModule dependencies initialized +0ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +7ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] BullModule dependencies initialized +1ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 7  - 09/07/2022, 9:40:04 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 7  - 09/07/2022, 9:40:09 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: getaddrinfo EAI_AGAIN immich
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)
[Nest] 7  - 09/07/2022, 9:40:17 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: getaddrinfo EAI_AGAIN immich
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)
[Nest] 7  - 09/07/2022, 9:40:25 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)...
Error: getaddrinfo EAI_AGAIN immich

and in postgress:

PostgreSQL init process complete; ready for start up.
2022-09-07 21:36:30.222 UTC [1] LOG:  starting PostgreSQL 14.5 (Debian 14.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2022-09-07 21:36:30.222 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-09-07 21:36:30.222 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2022-09-07 21:36:30.231 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-09-07 21:36:30.243 UTC [61] LOG:  database system was shut down at 2022-09-07 21:36:30 UTC
2022-09-07 21:36:30.250 UTC [1] LOG:  database system is ready to accept connections
@meichthys commented on GitHub (Sep 8, 2022): I'm also seeing this when deploying via docker-compose: ![image](https://user-images.githubusercontent.com/10717998/188988427-3148851f-51ef-4986-b7b9-d94cf76afceb.png) Here's the logs in microservices: ``` [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [NestFactory] Starting Nest application... [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] DatabaseModule dependencies initialized +47ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +1ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] BullModule dependencies initialized +0ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] JwtModule dependencies initialized +0ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] ConfigModule dependencies initialized +7ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] BullModule dependencies initialized +0ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] BullModule dependencies initialized +1ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] BullModule dependencies initialized +0ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] BullModule dependencies initialized +0ms [Nest] 7 - 09/07/2022, 9:40:04 PM LOG [InstanceLoader] BullModule dependencies initialized +0ms [Nest] 7 - 09/07/2022, 9:40:09 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... Error: getaddrinfo EAI_AGAIN immich at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) [Nest] 7 - 09/07/2022, 9:40:17 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)... Error: getaddrinfo EAI_AGAIN immich at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) [Nest] 7 - 09/07/2022, 9:40:25 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)... Error: getaddrinfo EAI_AGAIN immich ``` and in postgress: ``` PostgreSQL init process complete; ready for start up. 2022-09-07 21:36:30.222 UTC [1] LOG: starting PostgreSQL 14.5 (Debian 14.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit 2022-09-07 21:36:30.222 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 2022-09-07 21:36:30.222 UTC [1] LOG: listening on IPv6 address "::", port 5432 2022-09-07 21:36:30.231 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2022-09-07 21:36:30.243 UTC [61] LOG: database system was shut down at 2022-09-07 21:36:30 UTC 2022-09-07 21:36:30.250 UTC [1] LOG: database system is ready to accept connections ```
Author
Owner

@meichthys commented on GitHub (Sep 8, 2022):

Is this line correct in the docker-compose? It seems to be pointing to the wrong image?
853a65aef1/docker/docker-compose.yml (L19)

@meichthys commented on GitHub (Sep 8, 2022): Is this line correct in the docker-compose? It seems to be pointing to the wrong image? https://github.com/immich-app/immich/blob/853a65aef11bcb7d47a330ca5c20e3a23469cb83/docker/docker-compose.yml#L19
Author
Owner

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

Is this line correct in the docker-compose? It seems to be pointing to the wrong image?

853a65aef1/docker/docker-compose.yml (L19)

It is the correct image. Have you tried to restart your whole VM?

@alextran1502 commented on GitHub (Sep 8, 2022): > Is this line correct in the docker-compose? It seems to be pointing to the wrong image? > > https://github.com/immich-app/immich/blob/853a65aef11bcb7d47a330ca5c20e3a23469cb83/docker/docker-compose.yml#L19 It is the correct image. Have you tried to restart your whole VM?
Author
Owner

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

@meichthys Can you guys try to bring the containers down with docker-compose down then update docker-compose pull immich-web immich-server and finally docker-compose up again?

@alextran1502 commented on GitHub (Sep 8, 2022): @meichthys Can you guys try to bring the containers down with `docker-compose down` then update `docker-compose pull immich-web immich-server` and finally `docker-compose up` again?
Author
Owner

@ajoshuasmith commented on GitHub (Sep 8, 2022):

Hmm somehow you have no space left on the device

2022-09-07 10:43:40.469 UTC [1] FATAL: could not write lock file "postmaster.pid": No space left on device

I am now seeing no space left on the device doing that pull for the new version. 150GB allocated to this VM with only this running off of it. It's looking like an issue with my VM.

*Photos are stored on a share elsewhere

image

df -h

image

@ajoshuasmith commented on GitHub (Sep 8, 2022): > Hmm somehow you have no space left on the device > > `2022-09-07 10:43:40.469 UTC [1] FATAL: could not write lock file "postmaster.pid": No space left on device` I am now seeing no space left on the device doing that pull for the new version. 150GB allocated to this VM with only this running off of it. It's looking like an issue with my VM. *Photos are stored on a share elsewhere ![image](https://user-images.githubusercontent.com/78829059/188998539-69024634-c836-42a9-a1e9-d395de56b29a.png) df -h ![image](https://user-images.githubusercontent.com/78829059/188998238-8dfb504b-1c39-420c-8ee6-9a3623b32469.png)
Author
Owner

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

You are using 23G out of 23G of your root filesystem, you will need to expand your drive.
Screen Shot 2022-09-07 at 18 22 14

This might help, please proceed with caution https://askubuntu.com/questions/116351/increase-partition-size-on-which-ubuntu-is-installed

@alextran1502 commented on GitHub (Sep 8, 2022): You are using 23G out of 23G of your root filesystem, you will need to expand your drive. <img width="540" alt="Screen Shot 2022-09-07 at 18 22 14" src="https://user-images.githubusercontent.com/27055614/188999887-57b2866f-8b79-47df-8142-d67e282d19db.png"> This might help, please proceed with caution https://askubuntu.com/questions/116351/increase-partition-size-on-which-ubuntu-is-installed
Author
Owner

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

@ItsMeAPizza you can do docker images and remove the image that has no tags with docker rmi <image-id> to save space. Using docker means that you occasionally have to perform docker system prune

@alextran1502 commented on GitHub (Sep 8, 2022): @ItsMeAPizza you can do `docker images` and remove the image that has no tags with `docker rmi <image-id>` to save space. Using docker means that you occasionally have to perform `docker system prune`
Author
Owner

@ajoshuasmith commented on GitHub (Sep 8, 2022):

I am more than likely just going to rebuild the VM. Is there a way to point immich to the data folder that it created? Not a big deal to me if it's not possible since I can just re-upload everything.

Immich Data
image

Appreciate all the assistance @alextran1502!

@ajoshuasmith commented on GitHub (Sep 8, 2022): I am more than likely just going to rebuild the VM. Is there a way to point immich to the data folder that it created? Not a big deal to me if it's not possible since I can just re-upload everything. Immich Data ![image](https://user-images.githubusercontent.com/78829059/189000852-f4a7d88e-e50f-425e-b385-05acb471e629.png) Appreciate all the assistance @alextran1502!
Author
Owner

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

You will need to bring the Postgres mounted volume over to preserve the data in the database as well

@alextran1502 commented on GitHub (Sep 8, 2022): You will need to bring the Postgres mounted volume over to preserve the data in the database as well
Author
Owner

@meichthys commented on GitHub (Sep 8, 2022):

@meichthys Can you guys try to bring the containers down with docker-compose down then update docker-compose pull immich-web immich-server and finally docker-compose up again?

@alextran1502 I've tried repulsing the images without any difference. My guess is that it has something to do with the .eng file which I've loaded into portainer. I'm thinking that portainer is storing the environment variables in a different location than what the images are expecting.

With most docker projects I can just dump the environment variables into portainer with no issue, but something seems different here.

@meichthys commented on GitHub (Sep 8, 2022): > @meichthys Can you guys try to bring the containers down with `docker-compose down` then update `docker-compose pull immich-web immich-server` and finally `docker-compose up` again? @alextran1502 I've tried repulsing the images without any difference. My guess is that it has something to do with the .eng file which I've loaded into portainer. I'm thinking that portainer is storing the environment variables in a different location than what the images are expecting. With most docker projects I can just dump the environment variables into portainer with no issue, but something seems different here.
Author
Owner

@bo0tzz commented on GitHub (Sep 8, 2022):

@meichthys, the service is trying to connect to your database on the dns name immich

Unable to connect to the database. Retrying (1)...
Error: getaddrinfo EAI_AGAIN immich

Are you sure that's correct? Make sure to check your .env file and container names.

@bo0tzz commented on GitHub (Sep 8, 2022): @meichthys, the service is trying to connect to your database on the dns name `immich` > Unable to connect to the database. Retrying (1)... Error: getaddrinfo EAI_AGAIN immich Are you sure that's correct? Make sure to check your .env file and container names.
Author
Owner

@meichthys commented on GitHub (Sep 8, 2022):

@bo0tzz Thanks a lot! That was it. My .eng had a different name than my docker compose did for the Postgres container. After fixing the .env and removing my Postgres volume, it's working now!

@alextran1502 I think we can close this now 👍

@meichthys commented on GitHub (Sep 8, 2022): @bo0tzz Thanks a lot! That was it. My .eng had a different name than my docker compose did for the Postgres container. After fixing the .env and removing my Postgres volume, it's working now! @alextran1502 I think we can close this now 👍
Author
Owner

@Malopieds commented on GitHub (Sep 11, 2022):

Hi, I have the same issue on fresh install, on postgress logs I have:
2022-09-11 09:09:19.568 UTC [575] DETAIL: Role "postgres" does not exist.
and on microservices:

error: password authentication failed for user "postgres"
    at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

This happened on both custom install and one-step install, the problem isn't about space on disk, I tried clearing the cache/using other devices/browsers.
When connecting to http://:2283, i got
Request failed with status code 502,AxiosError,ERR_BAD_RESPONSE,[object Object],[object XMLHttpRequest],[object Object]

@Malopieds commented on GitHub (Sep 11, 2022): Hi, I have the same issue on fresh install, on postgress logs I have: ```2022-09-11 09:09:19.568 UTC [575] DETAIL: Role "postgres" does not exist.``` and on microservices: ```[Nest] 7 - 09/11/2022, 9:12:02 AM ERROR [ExceptionHandler] password authentication failed for user "postgres" error: password authentication failed for user "postgres" at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98) at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29) at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38) at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42) at Socket.emit (node:events:527:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at Socket.Readable.push (node:internal/streams/readable:228:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) ``` This happened on both custom install and one-step install, the problem isn't about space on disk, I tried clearing the cache/using other devices/browsers. When connecting to http://<machine-ip-address>:2283, i got ```Request failed with status code 502,AxiosError,ERR_BAD_RESPONSE,[object Object],[object XMLHttpRequest],[object Object]```
Author
Owner

@bo0tzz commented on GitHub (Sep 11, 2022):

Try clearing the postgres data volume: docker-compose down -v (or, if you mounted it to a path, delete the folder manually). Then bring everything back up. That should recreate the database and user.

@bo0tzz commented on GitHub (Sep 11, 2022): Try clearing the postgres data volume: `docker-compose down -v` (or, if you mounted it to a path, delete the folder manually). Then bring everything back up. That should recreate the database and user.
Author
Owner

@Malopieds commented on GitHub (Sep 11, 2022):

Thanks, it worked like a charm !

@Malopieds commented on GitHub (Sep 11, 2022): Thanks, it worked like a charm !
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#254