Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 Unexpected token < in JSON at position 0 SyntaxError: Unexpected token < in JSON at position 0 #170

Closed
wavesswe opened this issue May 22, 2022 · 81 comments

Comments

@wavesswe
Copy link

Running the docker compose thru Portainer, everyting starts up, I can see that ngnix is running at http://xxxx.xxx.xx.xx:2283/

But get the following issue when trying to access : http://xxxx.xxx.xx.xx:2285/

500
Unexpected token < in JSON at position 0
SyntaxError: Unexpected token < in JSON at position 0

in the logs from the web container

SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at Proxy. (file:///usr/src/app/build/server/index.js:1586:29)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async load (file:///usr/src/app/build/server/entries/pages/index.svelte.js:6:25)
at async load_node (file:///usr/src/app/build/server/index.js:1605:14)
at async respond$1 (file:///usr/src/app/build/server/index.js:1844:20)
at async resolve (file:///usr/src/app/build/server/index.js:2182:105)
at async Object.handle (file:///usr/src/app/build/server/chunks/hooks-35f923f5.js:7:12)
at async respond (file:///usr/src/app/build/server/index.js:2139:22)
at async Array.ssr (file:///usr/src/app/build/handler-edaaddc2.js:841:3)

Additional context

Is it me that are doing something wrong here or is it broken?

@wavesswe wavesswe added the bug label May 22, 2022
@alextran1502
Copy link
Contributor

Hello, did you specify VITE_SERVER_ENDPOINT= in your .env file?

@alextran1502
Copy link
Contributor

Additionally, did you include the https://github.com/alextran1502/immich/blob/main/docker/settings/nginx-conf/nginx.conf in your Portainer setup?

@wavesswe
Copy link
Author

I did include the .env file. I haven’t added that as extra some where. Where should I put that link?

@alextran1502
Copy link
Contributor

So you have the key VITE_SERVER_ENDPOINT= in your .env file, is that correct?

nginx.conf is the config file that the docker-compose build will look for during the build process, it looks like if you can access the web page/server, you should have specified that file already.

Can you capture the console and network tab in the browser dev tool (F12) for me when you access the web page.

@wavesswe
Copy link
Author

The vite server address is correct, I set the same port as in the example text. The Ngnix page is reachable. But when changing port to access setup I get the message. I will get you the info

@alextran1502
Copy link
Contributor

Can you pull the new image and test it? I did a few bugs fixed and performance optimization earlier this morning.

From the docker directory, run

docker-compose pull immich-web && docker-compose pull immich-server

@wavesswe
Copy link
Author

Hi!

Updated with same results.

from console

@wavesswe
Copy link
Author

rror with Permissions-Policy header: Origin trial controlled feature not enabled: 'interest-cohort'.
:2285/:1 GET http://192.168.x.xx:2285/ 500 (Internal Server Error)
css2:1 GET https://fonts.gstatic.com/s/worksans/v17/QGYsz_wNahGAdqQ43Rh_fKDp.woff2 net::ERR_NAME_NOT_RESOLVED
192.168.x.xx/:1 Access to fetch at 'http://192.168.x.xx:2283/server-info/ping' from origin 'http://192.168.x.xx:2285' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
api-fd31fb07.js:1 GET http://192.168.x.xx:2283/server-info/ping net::ERR_FAILED 404
h @ api-fd31fb07.js:1
p @ api-fd31fb07.js:1
(anonymous) @ __layout.svelte-2ad0b7e4.js:3
setInterval (async)
V @ __layout.svelte-2ad0b7e4.js:3
ke @ index-cf124ca0.js:4
Z @ __layout.svelte-2ad0b7e4.js:3
bt @ start-500b370a.js:1
kt @ start-500b370a.js:1
ke @ index-cf124ca0.js:4
Lt @ start-500b370a.js:1
Pe @ start-500b370a.js:1
_hydrate @ start-500b370a.js:1
await in _hydrate (async)
Yt @ start-500b370a.js:1
(anonymous) @ (index):38
api-fd31fb07.js:1 Uncaught (in promise) TypeError: Failed to fetch
at h (api-fd31fb07.js:1:285)
at p (api-fd31fb07.js:1:401)
at __layout.svelte-2ad0b7e4.js:3:704
h @ api-fd31fb07.js:1
p @ api-fd31fb07.js:1
(anonymous) @ __layout.svelte-2ad0b7e4.js:3
setInterval (async)
V @ __layout.svelte-2ad0b7e4.js:3
ke @ index-cf124ca0.js:4
Z @ __layout.svelte-2ad0b7e4.js:3
bt @ start-500b370a.js:1
kt @ start-500b370a.js:1
ke @ index-cf124ca0.js:4
Lt @ start-500b370a.js:1
Pe @ start-500b370a.js:1
_hydrate @ start-500b370a.js:1
await in _hydrate (async)
Yt @ start-500b370a.js:1
(anonymous) @ (index):38
192.168.3.75/:1 Access to fetch at 'http://192.168.x.xx:2283/server-info/ping' from origin 'http://192.168.x.xx:2285' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
api-fd31fb07.js:1 GET http://192.168.x.xx:2283/server-info/ping net::ERR_FAILED 404
h @ api-fd31fb07.js:1
p @ api-fd31fb07.js:1
(anonymous) @ __layout.svelte-2ad0b7e4.js:3
setInterval (async)
V @ __layout.svelte-2ad0b7e4.js:3
ke @ index-cf124ca0.js:4
Z @ __layout.svelte-2ad0b7e4.js:3
bt @ start-500b370a.js:1
kt @ start-500b370a.js:1
ke @ index-cf124ca0.js:4
Lt @ start-500b370a.js:1
Pe @ start-500b370a.js:1
_hydrate @ start-500b370a.js:1
await in _hydrate (async)
Yt @ start-500b370a.js:1
(anonymous) @ (index):38
api-fd31fb07.js:1 Uncaught (in promise) TypeError: Failed to fetch
at h (api-fd31fb07.js:1:285)
at p (api-fd31fb07.js:1:401)
at __layout.svelte-2ad0b7e4.js:3:704

Updated with same results. IP changed to x.xx but is correct.

@alextran1502
Copy link
Contributor

hmm interesting, let's isolate the issue of the setup!

Can you let me know what do you see when you enter http://your-ip:2283/server-info/ping into the web browser?

@spupuz
Copy link

spupuz commented May 23, 2022

same error here if i access http://your-ip:2283/server-info/ping i got {"res":"pong"}

@spupuz
Copy link

spupuz commented May 23, 2022


> web@0.0.1 build
> svelte-kit build

vite v2.9.8 building for production...
transforming...
✓ 687 modules transformed.
rendering chunks...
.svelte-kit/output/client/_app/manifest.json                                  3.94 KiB
.svelte-kit/output/client/_app/error.svelte-f8847189.js                       1.56 KiB / gzip: 0.74 KiB
.svelte-kit/output/client/_app/pages/__layout.svelte-7cc25e42.js              2.23 KiB / gzip: 1.09 KiB
.svelte-kit/output/client/_app/pages/admin/index.svelte-761d93c2.js           16.64 KiB / gzip: 5.97 KiB
.svelte-kit/output/client/_app/pages/auth/register/index.svelte-d5d075c6.js   6.45 KiB / gzip: 2.55 KiB
.svelte-kit/output/client/_app/start-60024a10.js                              24.18 KiB / gzip: 8.81 KiB
.svelte-kit/output/client/_app/pages/auth/login/index.svelte-aace14dc.js      16.03 KiB / gzip: 5.03 KiB
.svelte-kit/output/client/_app/pages/index.svelte-ddb910aa.js                 2.37 KiB / gzip: 1.21 KiB
.svelte-kit/output/client/_app/chunks/index-cf124ca0.js                       11.54 KiB / gzip: 4.78 KiB
.svelte-kit/output/client/_app/chunks/index-7389f52e.js                       0.79 KiB / gzip: 0.48 KiB
.svelte-kit/output/client/_app/chunks/singletons-d1fb5791.js                  0.05 KiB / gzip: 0.07 KiB
.svelte-kit/output/client/_app/chunks/api-a6083403.js                         0.45 KiB / gzip: 0.32 KiB
.svelte-kit/output/client/_app/chunks/constants-1610d5b2.js                   0.05 KiB / gzip: 0.07 KiB
.svelte-kit/output/client/_app/chunks/index-d39cff6c.js                       0.76 KiB / gzip: 0.41 KiB
.svelte-kit/output/client/_app/chunks/auth-api-b3e1ef61.js                    0.43 KiB / gzip: 0.16 KiB
.svelte-kit/output/client/_app/chunks/navigation-bar-cd758090.js              5.91 KiB / gzip: 2.58 KiB
.svelte-kit/output/client/_app/chunks/navigation-0e6511d1.js                  0.17 KiB / gzip: 0.15 KiB
.svelte-kit/output/client/_app/assets/pages/__layout.svelte-2c48307f.css      10.35 KiB / gzip: 2.98 KiB
.svelte-kit/output/client/_app/pages/photos/index.svelte-15e24c77.js          153.84 KiB / gzip: 53.49 KiB
vite v2.9.8 building SSR bundle for production...
transforming...
✓ 51 modules transformed.
rendering chunks...
.svelte-kit/output/server/manifest.json                                         4.36 KiB
.svelte-kit/output/server/index.js                                              75.63 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/index.ts.js              5.82 KiB
.svelte-kit/output/server/entries/endpoints/auth/register/index.ts.js           0.84 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/update.ts.js             1.42 KiB
.svelte-kit/output/server/entries/endpoints/admin/api/create-user.ts.js         0.93 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/api/select-admin.ts.js   1.77 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/api/get-users.ts.js      0.32 KiB
.svelte-kit/output/server/entries/pages/__layout.svelte.js                      1.21 KiB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js                     0.72 KiB
.svelte-kit/output/server/entries/pages/admin/index.svelte.js                   6.69 KiB
.svelte-kit/output/server/entries/pages/auth/login/index.svelte.js              1.94 KiB
.svelte-kit/output/server/entries/pages/auth/register/index.svelte.js           2.86 KiB
.svelte-kit/output/server/entries/pages/index.svelte.js                         1.74 KiB
.svelte-kit/output/server/entries/pages/photos/index.svelte.js                  8.96 KiB
.svelte-kit/output/server/chunks/index-6241e7e7.js                              4.26 KiB
.svelte-kit/output/server/chunks/constants-1610d5b2.js                          0.08 KiB
.svelte-kit/output/server/chunks/api-a833c381.js                                0.86 KiB
.svelte-kit/output/server/chunks/stores-78835596.js                             0.92 KiB
.svelte-kit/output/server/chunks/navigation-bar-07199bb6.js                     3.41 KiB
.svelte-kit/output/server/chunks/hooks-15a5604a.js                              1.12 KiB

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-node
  ✔ done
Listening on 0.0.0.0:3000
SyntaxError: Unexpected token e in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.handle (file:///usr/src/app/build/server/chunks/hooks-15a5604a.js:9:73)
    at respond (file:///usr/src/app/build/server/index.js:2139:42)
SyntaxError: Unexpected token e in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.handle (file:///usr/src/app/build/server/chunks/hooks-15a5604a.js:9:73)
    at respond (file:///usr/src/app/build/server/index.js:2139:42)
SyntaxError: Unexpected token e in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.handle (file:///usr/src/app/build/server/chunks/hooks-15a5604a.js:9:73)
    at respond (file:///usr/src/app/build/server/index.js:2139:42)

@alextran1502
Copy link
Contributor

@spupuz I believe you are also running Immich using Portainer, correct? Can you help me spin up a completely new Immich instance/stack and check if you are still encountering the same issue?

@spupuz
Copy link

spupuz commented May 23, 2022 via email

@spupuz
Copy link

spupuz commented May 23, 2022

database name is hardcoded for this reason can't spin up a double istance from scratch, i just have just one server :)

@alextran1502
Copy link
Contributor

Ah. Can you spin up a new instance that is not in Portainer?

I have a feeling this is an issue that related to the server is not updated to the newest version, so the front end is looking for things that the server doesn't have yet. Can you remove the server docker
container and pull it again from Dockerhub?

@alextran1502
Copy link
Contributor

Can you help me check this endpoint? http://your-ip:2283/server-info/version

@spupuz
Copy link

spupuz commented May 23, 2022

i can try

@spupuz
Copy link

spupuz commented May 23, 2022

http://your-ip:2283/server-info/version

http://192.168.1.112:2283/server-info/version

{"major":1,"minor":10,"patch":0,"build":14}

@alextran1502
Copy link
Contributor

hmm, this is the correct response. I will dig into this.

@spupuz
Copy link

spupuz commented May 23, 2022

With latest docker version server works but since I already have a user can create an admin user, how can I do?

@alextran1502
Copy link
Contributor

@spupuz After you log in on the web, if you have more than one account on the server, it will ask which account should be made admin. Otherwise, if you have only one account, it will make that account into the admin account :)

@spupuz
Copy link

spupuz commented May 23, 2022

@spupuz After you log in on the web, if you have more than one account on the server, it will ask which account should be made admin. Otherwise, if you have only one account, it will make that account into the admin account :)

Cool, just one point web interface does not adapt to browser in phone.

@alextran1502
Copy link
Contributor

@spupuz Understand, as it is not a priority right now, since you have a mobile app already to view/interact with the backup assets.

@spupuz
Copy link

spupuz commented May 23, 2022

Yah I know don't worry I'll put ideas and optmiziation as I see them, proud of being a test this is becoming a real piece of diamond

@alextran1502
Copy link
Contributor

@spupuz No problem, thank you for doing this. I just want to confirm that you can now access the web interface, correct?

@spupuz
Copy link

spupuz commented May 23, 2022

@spupuz No problem, thank you for doing this. I just want to confirm that you can now access the web interface, correct?

Yes I can will test it wider tomorrow with laptop

@phamleduy04
Copy link

I have the same problem. When I check the dev console I saw /server-info/ping is returning 404.

The error happen when I changed the VITE_SERVER_ENDPOINT to my public domain. When using IP is fine.

image

@jeanpaulrh
Copy link

I also have the same error, but I think caused by a different problem, since if I start docker-compose up without daemon option in the console I see this:

`immich-web_1 | FetchError: request to https://192.168.3.2:2285/192.168.3.2:2283/user/count failed, reason: write EPROTO 140497463036720:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:331:
immich-web_1 |
immich-web_1 | at ClientRequest. (file:///usr/src/app/build/shims-eb608bdd.js:6246:11)
immich-web_1 | at ClientRequest.emit (node:events:527:28)
immich-web_1 | at TLSSocket.socketErrorListener (node:_http_client:454:9)
immich-web_1 | at TLSSocket.emit (node:events:527:28)
immich-web_1 | at emitErrorNT (node:internal/streams/destroy:157:8)
immich-web_1 | at emitErrorCloseNT (node:internal/streams/destroy:122:3)
immich-web_1 | at processTicksAndRejections (node:internal/process/task_queues:83:21)
immich-web_1 | SyntaxError: Unexpected token < in JSON at position 0
immich-web_1 | at JSON.parse ()
immich-web_1 | at Proxy. (file:///usr/src/app/build/server/index.js:1586:29)
immich-web_1 | at processTicksAndRejections (node:internal/process/task_queues:96:5)
immich-web_1 | at async load (file:///usr/src/app/build/server/entries/pages/index.svelte.js:6:25)
immich-web_1 | at async load_node (file:///usr/src/app/build/server/index.js:1605:14)
immich-web_1 | at async respond$1 (file:///usr/src/app/build/server/index.js:1844:20)
immich-web_1 | at async resolve (file:///usr/src/app/build/server/index.js:2182:105)
immich-web_1 | at async Object.handle (file:///usr/src/app/build/server/chunks/hooks-0b1f7f3e.js:7:12)
immich-web_1 | at async respond (file:///usr/src/app/build/server/index.js:2139:22)
immich-web_1 | at async Array.ssr (file:///usr/src/app/build/handler-edaaddc2.js:841:3)
immich-web_1 | FetchError: request to https://192.168.3.2:2285/192.168.3.2:2283/user/count failed, reason: write EPROTO 140497463036720:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:331:
immich-web_1 |
immich-web_1 | at ClientRequest. (file:///usr/src/app/build/shims-eb608bdd.js:6246:11)
immich-web_1 | at ClientRequest.emit (node:events:527:28)
immich-web_1 | at TLSSocket.socketErrorListener (node:_http_client:454:9)
immich-web_1 | at TLSSocket.emit (node:events:527:28)
immich-web_1 | at emitErrorNT (node:internal/streams/destroy:157:8)
immich-web_1 | at emitErrorCloseNT (node:internal/streams/destroy:122:3)
immich-web_1 | at processTicksAndRejections (node:internal/process/task_queues:83:21)
immich-web_1 | SyntaxError: Unexpected token < in JSON at position 0
immich-web_1 | at JSON.parse ()
immich-web_1 | at Proxy. (file:///usr/src/app/build/server/index.js:1586:29)
immich-web_1 | at processTicksAndRejections (node:internal/process/task_queues:96:5)
immich-web_1 | at async load (file:///usr/src/app/build/server/entries/pages/index.svelte.js:6:25)
immich-web_1 | at async load_node (file:///usr/src/app/build/server/index.js:1605:14)
immich-web_1 | at async respond$1 (file:///usr/src/app/build/server/index.js:1844:20)
immich-web_1 | at async resolve (file:///usr/src/app/build/server/index.js:2182:105)
immich-web_1 | at async Object.handle (file:///usr/src/app/build/server/chunks/hooks-0b1f7f3e.js:7:12)
immich-web_1 | at async respond (file:///usr/src/app/build/server/index.js:2139:22)
immich-web_1 | at async Array.ssr (file:///usr/src/app/build/handler-edaaddc2.js:841:3)
immich-web_1 | FetchError: request to https://192.168.3.2:2285/192.168.3.2:2283/user/count failed, reason: write EPROTO 140497463036720:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:331:
immich-web_1 |
immich-web_1 | at ClientRequest. (file:///usr/src/app/build/shims-eb608bdd.js:6246:11)
immich-web_1 | at ClientRequest.emit (node:events:527:28)
immich-web_1 | at TLSSocket.socketErrorListener (node:_http_client:454:9)
immich-web_1 | at TLSSocket.emit (node:events:527:28)
immich-web_1 | at emitErrorNT (node:internal/streams/destroy:157:8)
immich-web_1 | at emitErrorCloseNT (node:internal/streams/destroy:122:3)
immich-web_1 | at processTicksAndRejections (node:internal/process/task_queues:83:21)
immich-web_1 | SyntaxError: Unexpected token < in JSON at position 0
immich-web_1 | at JSON.parse ()
immich-web_1 | at Proxy. (file:///usr/src/app/build/server/index.js:1586:29)
immich-web_1 | at processTicksAndRejections (node:internal/process/task_queues:96:5)
immich-web_1 | at async load (file:///usr/src/app/build/server/entries/pages/index.svelte.js:6:25)
immich-web_1 | at async load_node (file:///usr/src/app/build/server/index.js:1605:14)
immich-web_1 | at async respond$1 (file:///usr/src/app/build/server/index.js:1844:20)
immich-web_1 | at async resolve (file:///usr/src/app/build/server/index.js:2182:105)
immich-web_1 | at async Object.handle (file:///usr/src/app/build/server/chunks/hooks-0b1f7f3e.js:7:12)
immich-web_1 | at async respond (file:///usr/src/app/build/server/index.js:2139:22)
immich-web_1 | at async Array.ssr (file:///usr/src/app/build/handler-edaaddc2.js:841:3)

`
Maybe it's better for me to open a different Bug Report?

@spupuz
Copy link

spupuz commented May 24, 2022

i suppose on the latest docker version there was a regression

`.svelte-kit/output/server/entries/fallbacks/error.svelte.js 0.72 KiB
.svelte-kit/output/server/entries/pages/admin/index.svelte.js 6.69 KiB
.svelte-kit/output/server/entries/pages/auth/login/index.svelte.js 1.94 KiB
.svelte-kit/output/server/entries/pages/auth/register/index.svelte.js 2.86 KiB
.svelte-kit/output/server/entries/pages/index.svelte.js 1.74 KiB
.svelte-kit/output/server/entries/pages/photos/index.svelte.js 8.96 KiB
.svelte-kit/output/server/chunks/index-6241e7e7.js 4.26 KiB
.svelte-kit/output/server/chunks/constants-1610d5b2.js 0.08 KiB
.svelte-kit/output/server/chunks/api-a833c381.js 0.86 KiB
.svelte-kit/output/server/chunks/stores-78835596.js 0.92 KiB
.svelte-kit/output/server/chunks/navigation-bar-07199bb6.js 3.41 KiB
.svelte-kit/output/server/chunks/hooks-15a5604a.js 1.12 KiB

Run npm run preview to preview your production build locally.

Using @sveltejs/adapter-node
✔ done
Listening on 0.0.0.0:3000

web@0.0.1 build
svelte-kit build

vite v2.9.8 building for production...
transforming...
✓ 687 modules transformed.
rendering chunks...
.svelte-kit/output/client/_app/manifest.json 3.94 KiB
.svelte-kit/output/client/_app/pages/__layout.svelte-7cc25e42.js 2.23 KiB / gzip: 1.09 KiB
.svelte-kit/output/client/_app/error.svelte-f8847189.js 1.56 KiB / gzip: 0.74 KiB
.svelte-kit/output/client/_app/pages/auth/register/index.svelte-d5d075c6.js 6.45 KiB / gzip: 2.55 KiB
.svelte-kit/output/client/_app/start-8447ca62.js 24.18 KiB / gzip: 8.81 KiB
.svelte-kit/output/client/_app/pages/admin/index.svelte-761d93c2.js 16.64 KiB / gzip: 5.97 KiB
.svelte-kit/output/client/_app/pages/index.svelte-ddb910aa.js 2.37 KiB / gzip: 1.21 KiB
.svelte-kit/output/client/_app/pages/auth/login/index.svelte-aace14dc.js 16.03 KiB / gzip: 5.03 KiB
.svelte-kit/output/client/_app/chunks/index-7389f52e.js 0.79 KiB / gzip: 0.48 KiB
.svelte-kit/output/client/_app/chunks/singletons-d1fb5791.js 0.05 KiB / gzip: 0.07 KiB
.svelte-kit/output/client/_app/chunks/index-cf124ca0.js 11.54 KiB / gzip: 4.78 KiB
.svelte-kit/output/client/_app/chunks/api-a6083403.js 0.45 KiB / gzip: 0.32 KiB
.svelte-kit/output/client/_app/chunks/constants-1610d5b2.js 0.05 KiB / gzip: 0.07 KiB
.svelte-kit/output/client/_app/chunks/index-d39cff6c.js 0.76 KiB / gzip: 0.41 KiB
.svelte-kit/output/client/_app/chunks/auth-api-b3e1ef61.js 0.43 KiB / gzip: 0.16 KiB
.svelte-kit/output/client/_app/chunks/navigation-0e6511d1.js 0.17 KiB / gzip: 0.15 KiB
.svelte-kit/output/client/_app/chunks/navigation-bar-cd758090.js 5.91 KiB / gzip: 2.58 KiB
.svelte-kit/output/client/_app/assets/pages/__layout.svelte-2c48307f.css 10.35 KiB / gzip: 2.98 KiB
.svelte-kit/output/client/_app/pages/photos/index.svelte-15e24c77.js 153.84 KiB / gzip: 53.49 KiB
vite v2.9.8 building SSR bundle for production...
transforming...
✓ 51 modules transformed.
rendering chunks...
.svelte-kit/output/server/manifest.json 4.36 KiB
.svelte-kit/output/server/index.js 75.63 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/index.ts.js 5.82 KiB
.svelte-kit/output/server/entries/endpoints/auth/register/index.ts.js 0.84 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/update.ts.js 1.42 KiB
.svelte-kit/output/server/entries/endpoints/admin/api/create-user.ts.js 0.93 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/api/select-admin.ts.js 1.77 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/api/get-users.ts.js 0.32 KiB
.svelte-kit/output/server/entries/pages/__layout.svelte.js 1.21 KiB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js 0.72 KiB
.svelte-kit/output/server/entries/pages/admin/index.svelte.js 6.69 KiB
.svelte-kit/output/server/entries/pages/auth/login/index.svelte.js 1.94 KiB
.svelte-kit/output/server/entries/pages/auth/register/index.svelte.js 2.86 KiB
.svelte-kit/output/server/entries/pages/index.svelte.js 1.74 KiB
.svelte-kit/output/server/entries/pages/photos/index.svelte.js 8.96 KiB
.svelte-kit/output/server/chunks/index-6241e7e7.js 4.26 KiB
.svelte-kit/output/server/chunks/constants-1610d5b2.js 0.08 KiB
.svelte-kit/output/server/chunks/api-a833c381.js 0.86 KiB
.svelte-kit/output/server/chunks/stores-78835596.js 0.92 KiB
.svelte-kit/output/server/chunks/navigation-bar-07199bb6.js 3.41 KiB
.svelte-kit/output/server/chunks/hooks-15a5604a.js 1.12 KiB

Run npm run preview to preview your production build locally.

Using @sveltejs/adapter-node
✔ done
Listening on 0.0.0.0:3000
SyntaxError: Unexpected token e in JSON at position 0
at JSON.parse ()
at Object.handle (file:///usr/src/app/build/server/chunks/hooks-15a5604a.js:9:73)
at respond (file:///usr/src/app/build/server/index.js:2139:42)
SyntaxError: Unexpected token e in JSON at position 0
at JSON.parse ()
at Object.handle (file:///usr/src/app/build/server/chunks/hooks-15a5604a.js:9:73)
at respond (file:///usr/src/app/build/server/index.js:2139:42)
SyntaxError: Unexpected token e in JSON at position 0
at JSON.parse ()
at Object.handle (file:///usr/src/app/build/server/chunks/hooks-15a5604a.js:9:73)
at respond (file:///usr/src/app/build/server/index.js:2139:42)
SyntaxError: Unexpected token e in JSON at position 0
at JSON.parse ()
at Object.handle (file:///usr/src/app/build/server/chunks/hooks-15a5604a.js:9:73)
at respond (file:///usr/src/app/build/server/index.js:2139:42)
SyntaxError: Unexpected token e in JSON at position 0
at JSON.parse ()
at Object.handle (file:///usr/src/app/build/server/chunks/hooks-15a5604a.js:9:73)
at respond (file:///usr/src/app/build/server/index.js:2139:42)
SyntaxError: Unexpected token e in JSON at position 0
at JSON.parse ()
at Object.handle (file:///usr/src/app/build/server/chunks/hooks-15a5604a.js:9:73)
at respond (file:///usr/src/app/build/server/index.js:2139:42)`

@mada199122
Copy link

This is my compose stack but I'm not able to get it works always

500
Unexpected token a in JSON at position 0
SyntaxError: Unexpected token a in JSON at position 0
services:

  immich-server:
    image: altran1502/immich-server:latest
    container_name: "immich-server"
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    networks:
      immich:
    expose:
      - 3000 
    volumes:
      - "/REDACTED/Upload:/usr/src/app/upload"
    env_file:
      - /REDACTED/.env
    environment:
      - NODE_ENV=production
    depends_on:
      - immich_redis
      - immich_postgres
    restart: unless-stopped


  immich-web:
    image: altran1502/immich-web:latest
    container_name: "immich-web"
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    networks:
      immich:
    env_file:
      - /REDACTED/.env
    ports:
      - 2285:3000
    restart: unless-stopped

  immich_redis:
    container_name: "immich_redis"
    image: redis:6.2
    networks:
      immich:
    volumes:
      - "/REDACTED:/data"
    restart: unless-stopped
    

  immich_postgres:
    container_name: "immich_postgres"
    image: postgres:14
    networks:
      immich:
    env_file:
      - /REDACTED/.env
    environment:
      POSTGRES_PASSWORD: ${IMMICH_PG_DB_PASSWORD}
      POSTGRES_USER: ${IMMICH_PG_DB_USERNAME}
      POSTGRES_DB: ${IMMICH_PG_DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - "/REDACTED/:/var/lib/postgresql/data"
    restart: unless-stopped


networks:

  immich:
    driver: bridge
    name: "immich"
    internal: false
    ipam:
      driver: default
      config:
        - subnet: 172.23.25.0/24
          gateway: 172.23.25.1

THE env file instead is this one

DB_HOSTNAME=immich_postgres
###################################################################################
# Database
###################################################################################
DB_USERNAME=XXXXXXXXXXXXX
DB_PASSWORD=XXXXXXXXXXXXX
DB_DATABASE_NAME=XXXXXXXXXXXXX



###################################################################################
# Upload File Config
###################################################################################
UPLOAD_LOCATION=./upload



###################################################################################
# JWT SECRET
###################################################################################
JWT_SECRET=XXXXXXXXXXXXX


###################################################################################
# MAPBOX
####################################################################################
# ENABLE_MAPBOX is either true of false -> if true, you have to provide MAPBOX_KEY
ENABLE_MAPBOX=true
MAPBOX_KEY=XXXXXXXXXXXXX



###################################################################################
# WEB
###################################################################################
# This is the URL of your vm/server where you host Immich, so that the web frontend
# know where can it make the request to.
# For example: If your server IP address is 10.1.11.50, the environment variable will
# be VITE_SERVER_ENDPOINT=http://10.1.11.50:2283
VITE_SERVER_ENDPOINT=http://IP-OF-MY-SERVER:2283


###################################################################################
# Redis
###################################################################################

REDIS_HOSTNAME=immich_redis

Why should VITE_SERVER_ENDPOINT point to port 2283 if it is not present in the compose?

In any cane here the log

IMMICH SERVER

> immich@1.5.1 prebuild
> rimraf dist


> immich@1.5.1 build
�
> nest build


> immich@1.5.1 start:prod
> node dist/main

[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [NestFactory] Starting Nest application...
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +169ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] BullModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] JwtModule dependencies initialized +2ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] AppModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +0ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] ConfigModule dependencies initialized +12ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] ScheduleModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] BullModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] BullModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] BullModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 52  - 05/27/2022, 6:32:09 AM     LOG [InstanceLoader] ServerInfoModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] TypeOrmCoreModule dependencies initialized +301ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] CommunicationModule dependencies initialized +4ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] ImmichJwtModule dependencies initialized +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] ScheduleTasksModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] BackgroundTaskModule dependencies initialized +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] ImageOptimizeModule dependencies initialized +4ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] DeviceInfoModule dependencies initialized +2ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] SharingModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] AuthModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] UserModule dependencies initialized +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [InstanceLoader] AssetModule dependencies initialized +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RoutesResolver] AppController {/}: +20ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/, GET} route +5ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RoutesResolver] UserController {/user}: +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/user, GET} route +2ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/user, POST} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/user/count, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/user, PUT} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RoutesResolver] AssetController {/asset}: +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/upload, POST} route +2ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/download, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/file, GET} route +2ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/thumbnail/:assetId, GET} route +2ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/allObjects, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/allLocation, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/searchTerm, GET} route +2ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/search, POST} route +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/:deviceId, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset/assetById/:assetId, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/asset, DELETE} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RoutesResolver] AuthController {/auth}: +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/auth/login, POST} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/auth/admin-sign-up, POST} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/auth/validateToken, POST} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RoutesResolver] DeviceInfoController {/device-info}: +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/device-info, POST} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/device-info, PATCH} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RoutesResolver] ServerInfoController {/server-info}: +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/server-info, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/server-info/ping, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/server-info/mapbox, GET} route +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/server-info/version, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RoutesResolver] SharingController {/shared}: +0ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/shared/createAlbum, POST} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/shared/addUsers, POST} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/shared/addAssets, POST} route +3ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/shared/allSharedAlbums, GET} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/shared/:albumId, GET} route +2ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/shared/removeAssets, DELETE} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/shared/:albumId, DELETE} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/shared/leaveAlbum/:albumId, DELETE} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [RouterExplorer] Mapped {/shared/updateInfo, PATCH} route +1ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [NestApplication] Nest application successfully started +41ms
[Nest] 52  - 05/27/2022, 6:32:10 AM     LOG [IMMICH SERVER] Running Immich Server in PRODUCTION environment 

Here IMMICH WEB

> web@0.0.1 build
> svelte-kit build

vite v2.9.8 building for production...
transforming...
✓ 687 modules transformed.
rendering chunks...
.svelte-kit/output/client/_app/manifest.json                                  3.94 KiB
.svelte-kit/output/client/_app/start-7968382e.js                              24.18 KiB / gzip: 8.81 KiB
.svelte-kit/output/client/_app/pages/auth/login/index.svelte-aace14dc.js      16.03 KiB / gzip: 5.03 KiB
.svelte-kit/output/client/_app/error.svelte-f8847189.js                       1.56 KiB / gzip: 0.74 KiB
.svelte-kit/output/client/_app/pages/admin/index.svelte-9879ae55.js           16.64 KiB / gzip: 5.97 KiB
.svelte-kit/output/client/_app/pages/__layout.svelte-200db308.js              2.23 KiB / gzip: 1.09 KiB
.svelte-kit/output/client/_app/pages/index.svelte-43ca08b8.js                 2.37 KiB / gzip: 1.21 KiB
.svelte-kit/output/client/_app/chunks/index-cf124ca0.js                       11.54 KiB / gzip: 4.78 KiB
.svelte-kit/output/client/_app/chunks/singletons-d1fb5791.js                  0.05 KiB / gzip: 0.07 KiB
.svelte-kit/output/client/_app/chunks/api-8119291a.js                         0.45 KiB / gzip: 0.32 KiB
.svelte-kit/output/client/_app/chunks/constants-f22e011b.js                   0.05 KiB / gzip: 0.06 KiB
.svelte-kit/output/client/_app/chunks/index-d39cff6c.js                       0.76 KiB / gzip: 0.41 KiB
.svelte-kit/output/client/_app/chunks/navigation-bar-cd758090.js              5.91 KiB / gzip: 2.58 KiB
.svelte-kit/output/client/_app/chunks/auth-api-b3e1ef61.js                    0.43 KiB / gzip: 0.16 KiB
.svelte-kit/output/client/_app/chunks/navigation-0e6511d1.js                  0.17 KiB / gzip: 0.15 KiB
.svelte-kit/output/client/_app/assets/pages/__layout.svelte-2c48307f.css      10.35 KiB / gzip: 2.98 KiB
.svelte-kit/output/client/_app/chunks/index-7389f52e.js                       0.79 KiB / gzip: 0.48 KiB
.svelte-kit/output/client/_app/pages/auth/register/index.svelte-ea0c4574.js   6.45 KiB / gzip: 2.55 KiB
.svelte-kit/output/client/_app/pages/photos/index.svelte-88ebb3cf.js          153.84 KiB / gzip: 53.48 KiB
vite v2.9.8 building SSR bundle for production...
transforming...
✓ 51 modules transformed.
rendering chunks...
.svelte-kit/output/server/manifest.json                                         4.36 KiB
.svelte-kit/output/server/index.js                                              75.63 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/index.ts.js              5.82 KiB
.svelte-kit/output/server/entries/endpoints/auth/register/index.ts.js           0.84 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/update.ts.js             1.42 KiB
.svelte-kit/output/server/entries/endpoints/admin/api/create-user.ts.js         0.93 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/api/select-admin.ts.js   1.77 KiB
.svelte-kit/output/server/entries/endpoints/auth/login/api/get-users.ts.js      0.32 KiB
.svelte-kit/output/server/entries/pages/__layout.svelte.js                      1.21 KiB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js                     0.72 KiB
.svelte-kit/output/server/entries/pages/admin/index.svelte.js                   6.69 KiB
.svelte-kit/output/server/entries/pages/auth/login/index.svelte.js              1.94 KiB
.svelte-kit/output/server/entries/pages/auth/register/index.svelte.js           2.86 KiB
.svelte-kit/output/server/entries/pages/index.svelte.js                         1.74 KiB
.svelte-kit/output/server/entries/pages/photos/index.svelte.js                  8.96 KiB
.svelte-kit/output/server/chunks/index-6241e7e7.js                              4.26 KiB
.svelte-kit/output/server/chunks/constants-f22e011b.js                          0.08 KiB
.svelte-kit/output/server/chunks/api-75d724dc.js                                0.86 KiB
.svelte-kit/output/server/chunks/stores-78835596.js                             0.92 KiB
.svelte-kit/output/server/chunks/navigation-bar-07199bb6.js                     3.41 KiB
.svelte-kit/output/server/chunks/hooks-3418e942.js                              1.12 KiB

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-node
  ✔ done
Listening on 0.0.0.0:3000
SyntaxError: Unexpected token a in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.handle (file:///usr/src/app/build/server/chunks/hooks-3418e942.js:9:73)
    at respond (file:///usr/src/app/build/server/index.js:2139:42)
SyntaxError: Unexpected token a in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.handle (file:///usr/src/app/build/server/chunks/hooks-3418e942.js:9:73)
    at respond (file:///usr/src/app/build/server/index.js:2139:42)
SyntaxError: Unexpected token a in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.handle (file:///usr/src/app/build/server/chunks/hooks-3418e942.js:9:73)
    at respond (file:///usr/src/app/build/server/index.js:2139:42)

@alextran1502
Copy link
Contributor

@mada199122 The reason you cannot access is that you removed the Nginx container. The server is served via Nginx via port 2283 which is mapped to port 80 of the Nginx container.

@ghost
Copy link

ghost commented May 27, 2022

I've VITE_SERVER_ENDPOINT=http://10.1.11.50:2283/, I get the following error

FetchError: request to https://domain.tld/%22http://10.1.11.50:2283%22/user/count failed, reason: unable to get local issuer certificate
    at ClientRequest.<anonymous> (file:///usr/src/app/build/shims-eb608bdd.js:6246:11)
    at ClientRequest.emit (node:events:527:28)
    at TLSSocket.socketErrorListener (node:_http_client:454:9)
    at TLSSocket.emit (node:events:527:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Proxy.<anonymous> (file:///usr/src/app/build/server/index.js:1586:29)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async load (file:///usr/src/app/build/server/entries/pages/index.svelte.js:6:25)
    at async load_node (file:///usr/src/app/build/server/index.js:1605:14)
    at async respond$1 (file:///usr/src/app/build/server/index.js:1844:20)
    at async resolve (file:///usr/src/app/build/server/index.js:2182:105)
    at async Object.handle (file:///usr/src/app/build/server/chunks/hooks-887180e1.js:7:12)
    at async respond (file:///usr/src/app/build/server/index.js:2139:22)
    at async Array.ssr (file:///usr/src/app/build/handler-edaaddc2.js:841:3)

I'm able to access the below endpoints
http://10.1.11.50:2283/server-info/ping
{"res":"pong"}
http://10.1.11.50:2283/server-info/version
{"major":1,"minor":10,"patch":0,"build":14}

@alextran1502
Copy link
Contributor

@badlandspray Are you using your own reverse proxy setup? Can you try to fix the VITE_SERVER_ENDPOINT by removing the forward slash at the end of the IP address, so http://10.1.11.50:2283 instead of http://10.1.11.50:2283/?

After fixing that, can you access http://10.1.11.50:2285?

@mada199122
Copy link

mada199122 commented May 28, 2022

@mada199122 The reason you cannot access is that you removed the Nginx container. The server is served via Nginx via port 2283 which is mapped to port 80 of the Nginx container.

Ok thank you.
Now I've added the Nginx container to the compose

  immich_nginx_proxy:
    container_name: immich_nginx_proxy
    image: nginx:latest
    networks:
      immich:
    volumes:
      - "path_to_the_folder:/etc/nginx/conf.d:rw"
    # logging:
    #   driver: none
    ports:
      - 2283:80
      - 2284:443
    depends_on:
      - immich-server
    restart: unless-stopped

And now I have this error:

500
Unexpected token b in JSON at position 4
SyntaxError: Unexpected token b in JSON at position 4

The log of the web container and the server container are exactly the same as the attached one of my previous post.

But now I'm able to get this
http://X.X.X.X:2283/server-info/ping
{"res":"pong"}
http://X.X.X.X:2283/server-info/version
{"major":1,"minor":10,"patch":0,"build":14}

The log NGINX is the following one

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/05/28 06:44:05 [emerg] 1#1: host not found in upstream "immich-server" in /etc/nginx/conf.d/nginx.conf:43
nginx: [emerg] host not found in upstream "immich-server" in /etc/nginx/conf.d/nginx.conf:43
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/05/28 06:44:06 [notice] 1#1: using the "epoll" event method
2022/05/28 06:44:06 [notice] 1#1: nginx/1.21.6
2022/05/28 06:44:06 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
2022/05/28 06:44:06 [notice] 1#1: OS: Linux 4.4.180+
2022/05/28 06:44:06 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2022/05/28 06:44:06 [notice] 1#1: start worker processes
2022/05/28 06:44:06 [notice] 1#1: start worker process 23
2022/05/28 06:44:06 [notice] 1#1: start worker process 24
2022/05/28 06:44:06 [notice] 1#1: start worker process 25
2022/05/28 06:44:06 [notice] 1#1: start worker process 26

@alextran1502
Copy link
Contributor

@mada199122 there is the configuration file of Nginx in the 'docker' folder of the repo that you have to include in your setup.

@ghost
Copy link

ghost commented May 28, 2022

@alextran1502 Now, I'm able to access the :2285and I created an account, upon visting /admin I get the below error:'

500

NetworkError when attempting to fetch resource.

h@https://domain.tld/_app/chunks/api-ccfa9cbd.js:1:285
p@https://domain.tld/_app/chunks/api-ccfa9cbd.js:1:401
Ut@https://domain.tld/_app/pages/admin/index.svelte-52a2a867.js:1:16446
Q@https://domain.tld/_app/start-179688cd.js:1:17679
Ne@https://domain.tld/_app/start-179688cd.js:1:18906

Console errors

Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource.
    h https://domain.tld/_app/chunks/api-ccfa9cbd.js:1
    p https://domain.tld/_app/chunks/api-ccfa9cbd.js:1
    y https://domain.tld/_app/pages/__layout.svelte-8a85a46c.js:3
Blocked loading mixed active content “http://10.1.11.50:2283/asset”

Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource.
    h https://domain.tld/_app/chunks/api-ccfa9cbd.js:1
    p https://domain.tld/_app/chunks/api-ccfa9cbd.js:1
    mD https://domain.tld/_app/pages/photos/index.svelte-5e7225f8.js:37
    tE https://domain.tld/_app/pages/photos/index.svelte-5e7225f8.js:37
    U https://domain.tld/_app/chunks/index-cf124ca0.js:1
    Ot https://domain.tld/_app/chunks/index-cf124ca0.js:4
    I https://domain.tld/_app/chunks/index-cf124ca0.js:4

Blocked loading mixed active content “http://10.1.11.50:2283/user”

Blocked loading mixed active content “http://10.1.11.50:2283/server-info/ping”

Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource.
    h https://domain.tld/_app/chunks/api-ccfa9cbd.js:1
    p https://domain.tld/_app/chunks/api-ccfa9cbd.js:1
    y https://domain.tld/_app/pages/__layout.svelte-8a85a46c.js:3

Blocked loading mixed active content “http://10.1.11.50:2283/server-info/ping”

@alextran1502
Copy link
Contributor

@badlandspray is this from your access through the local IP or from the public domain that is proxied to the private IP?

@ghost
Copy link

ghost commented May 28, 2022

Local IP. I'm using caddy. I've tried setting VITE_SERVER_ENDPOINT=http://immich-server:3000.as well. Must be something wrong on my side.

@alextran1502
Copy link
Contributor

@badlandspray If you start fresh from the beginning and follow the readme file, do you have any problems?

@mada199122
Copy link

mada199122 commented May 29, 2022

@mada199122 there is the configuration file of Nginx in the 'docker' folder of the repo that you have to include in your setup.

Yes of course I've already put that file in the mount volume of nginx container

Screenshot 2022-05-29 at 16 18 30

But It seams from the log that nginx container is asking for a default configuration file

from this line of the log

10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist

@alextran1502
Copy link
Contributor

alextran1502 commented May 29, 2022

@mada199122 This is the location that the Nginx container is looking for the config file

Screen Shot 2022-05-29 at 09 21 19

If you look at the docker folder in the repo, the nginx.conf is put in the folder settings/nginx-conf. Perhaps you have to create 2 folders settings > nginx-conf then put the config file in there.

I am not sure which tool you use to run the application so I don't have more information to fully provide support.

@mada199122
Copy link

But in docker compose the left path should be whatever I want in my host machine that it will be translated by docker to the path at the right side inside the container.
it shouldn't matter...

Now I've modified the compose to include the two folder as suggeste but nothing has changed:(

Screenshot 2022-05-29 at 16 18 30

  immich_nginx_proxy:
    container_name: immich_nginx_proxy
    image: nginx:latest
    networks:
      immich:
    volumes:
      - "/volume1/docker/Immich/nginx/settings/nginx-conf:/etc/nginx/conf.d"
    # logging:
    #   driver: none
    ports:
      - 2283:80
      - 2284:443
    depends_on:
      - immich-server
    restart: unless-stopped

@alextran1502
Copy link
Contributor

@mada199122 I am not sure if you have uploaded the correct image but it seems to not the correct path you showed in the docker-compose file

@mada199122
Copy link

no it is correct, /volume1 is not shown in the GUI of Synology NAS

I've attached a screenshot from the shell

Screenshot 2022-05-29 at 16 44 03

@alextran1502
Copy link
Contributor

@mada199122 Let's try two things

  1. Can you remove the double quote to see if it make the different, so /volume1/docker/Immich/nginx/settings/nginx-conf:/etc/nginx/conf.d
  2. If the above doesn't work, can you commented out the Nginx container and expose the port in the immich-server container by adding
ports:
  - 2283:3000

@mada199122
Copy link

tried both but nothing... always the same error..

@mada199122
Copy link

mada199122 commented May 29, 2022

At the port 2283 I get this now

Screenshot 2022-05-29 at 17 37 03

@alextran1502
Copy link
Contributor

@mada199122 Can you post your docker-compose file again? Did you perform docker-compose down and docker-compose up after you updated the file content?

@mada199122
Copy link

mada199122 commented May 29, 2022

Yes I've removed completely all the container and re-created

This is my actual compose

services:
  immich-server:
    image: altran1502/immich-server:latest
    container_name: "immich-server"
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    networks:
      immich:
    volumes:
      - /volume1/docker/Immich/Upload:/usr/src/app/upload
    env_file:
      - /volume1/docker/Immich/Immich.env
    expose:
      - 3000
    environment:
      - NODE_ENV=production
    depends_on:
      - immich_redis
      - immich_postgres
    restart: unless-stopped

  immich-web:
    image: altran1502/immich-web:latest
    container_name: "immich-web"
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    networks:
      immich:
    env_file:
      - /volume1/docker/Immich/Immich.env
    ports:
      - 2285:3000
    restart: unless-stopped

  immich_redis:
    container_name: "immich_redis"
    image: redis:6.2
    networks:
      immich:
    volumes:
      - /volume1/docker/Immich/Redis:/data

  immich_postgres:
    container_name: "immich_postgres"
    image: postgres:14
    networks:
      immich:
    env_file:
      - /volume1/docker/Immich/Immich.env
    environment:
      POSTGRES_PASSWORD: ${IMMICH_PG_DB_PASSWORD}
      POSTGRES_USER: ${IMMICH_PG_DB_USERNAME}
      POSTGRES_DB: ${IMMICH_PG_DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - /volume1/docker/Immich/Database:/var/lib/postgresql/data
    restart: unless-stopped


  immich_nginx_proxy:
    container_name: immich_nginx_proxy
    image: nginx:latest
    networks:
      immich:
    volumes:
      - /volume1/docker/Immich/nginx/settings/nginx-conf:/etc/nginx/conf.d
    # logging:
    #   driver: none
    ports:
      - 2283:80
      - 2284:443
    depends_on:
      - immich-server
    restart: unless-stopped


networks:

  immich:
    driver: bridge
    name: "immich"
    internal: false
    ipam:
      driver: default
      config:
        - subnet: 172.23.25.0/24
          gateway: 172.23.25.1

@alextran1502
Copy link
Contributor

@mada199122 Before changing the content of the docker-compose, if you keep the same content and follow the direction in the readme file, with placing the nginx.conf at the correct location, can you test this scenario first? Then gradually change each container to your settings to catch errors incrementally

@mada199122
Copy link

mada199122 commented May 30, 2022

@mada199122 Before changing the content of the docker-compose, if you keep the same content and follow the direction in the readme file, with placing the nginx.conf at the correct location, can you test this scenario first? Then gradually change each container to your settings to catch errors incrementally

sorry I my previous post I copied the wrong NGINX compose, now I correct...

nginx.conf is in the correct location mapped in docker compose...

./settings/nginx-conf:/etc/nginx/conf.d is exactly equivalent than mine...
sorry but I cannot understand the difference been that string a mapping path left to right

Could you explain me what is causing this of this error please?

Unexpected token b in JSON at position 4
SyntaxError: Unexpected token b in JSON at position 4

So I can try to understand better what is wrong.

from my limited point of view it seams that immich-web is not able to talk to nginx if it speaks to nginx or to the server...
because from http://IP:2283/server-info/ping I'm getting the answer "pong", so nginx and immich-server containers are talking each other...

In immich-web log I see this

SyntaxError: Unexpected token b in JSON at position 4
at JSON.parse (<anonymous>)
at Object.handle (file:///usr/src/app/build/server/chunks/hooks-3418e942.js:9:73)
at respond (file:///usr/src/app/build/server/index.js:2139:42)

@wavesswe
Copy link
Author

wavesswe commented May 30, 2022

/server-info/ping

I get 404 Not Found, before i tried i ran "docker-compose pull immich-web && docker-compose pull immich-server" again.

I can read the http://192.168.x.xx:2285/auth/login page but the http://192.168.x.xx:2285 page still throws the same error

@alextran1502
Copy link
Contributor

@wavesswe Can you try to clear the session in the cookie from the web dev tool?

@alextran1502
Copy link
Contributor

@mada199122 Before changing the content of the docker-compose, if you keep the same content and follow the direction in the readme file, with placing the nginx.conf at the correct location, can you test this scenario first? Then gradually change each container to your settings to catch errors incrementally

sorry I my previous post I copied the wrong NGINX compose, now I correct...

nginx.conf is in the correct location mapped in docker compose...

./settings/nginx-conf:/etc/nginx/conf.d is exactly equivalent than mine... sorry but I cannot understand the difference been that string a mapping path left to right

Could you explain me what is causing this of this error please?

Unexpected token b in JSON at position 4
SyntaxError: Unexpected token b in JSON at position 4

So I can try to understand better what is wrong.

from my limited point of view it seams that immich-web is not able to talk to nginx if it speaks to nginx or to the server... because from http://IP:2283/server-info/ping I'm getting the answer "pong", so nginx and immich-server containers are talking each other...

In immich-web log I see this

SyntaxError: Unexpected token b in JSON at position 4
at JSON.parse (<anonymous>)
at Object.handle (file:///usr/src/app/build/server/chunks/hooks-3418e942.js:9:73)
at respond (file:///usr/src/app/build/server/index.js:2139:42)

I am not sure why you are seeing that either, have you tried clearing the session in the cookie of the browser dev tool?

image

@mada199122
Copy link

Finally I got it working...
I don't know actually what I've done... But yesterday after many failed attempts I shut all the 4 containers down...
Now to try to clear the cookie session as you suggested I started the containers and magically now works...

I have two clues...
yesterday I've change the name of the nginx container, before I was using "immich_nginx_proxy" now I changed to the default one you use in your compose.

this is my nginx compose now

  nginx:
    container_name: proxy_nginx
    image: nginx:latest
    networks:
      immich:
    volumes:
      - /volume1/docker/Immich/nginx/settings/nginx-conf:/etc/nginx/conf.d/
    # logging:
    #   driver: none
    ports:
      - 2283:80
      - 2284:443
    depends_on:
      - immich-server
    restart: unless-stopped

In the code of the container immich-web, have you hardcoded the address of the nginx container by its name of the container?

The second clue is that the last days I was using Safari browser during all the attempts, today accidentally I've tried to access immich-web with Firefox...
Now I don't know what to think... it seams it works on both browser...

@alextran1502
Copy link
Contributor

@mada199122 I am glad it is working now for you. Perhaps you didn't shut down the container before when you perform the docker-compose pull step? Probably shutting it down perform a complete reset and register the most recent code change for the application

@alextran1502
Copy link
Contributor

Closing this issue as this is mostly a configuration problem from the user's side and it has expanded into an issue with scattered information about a different topic.

Please visit the Discord channel for additional help https://discord.gg/rxnyVTXGbM

@spupuz
Copy link

spupuz commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants