-
Notifications
You must be signed in to change notification settings - Fork 49
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
Docker-compose first setup SyntaxError Unexpected token < in JSON at position 0 #138
Comments
Hi @EinAeffchen Thank you for using HomeGallery and reporting your issue here with detailed logs. It seems that the api server has an invalid response which is not a json format. What is your api server settings, which is apparently If you use a different api server, please check that the responses are valid. |
Thanks for the quick help! You're right I mistakenly put my url in there instead of the api url. However, I realized I can't get the API Image to run, it errors with the following logs, independent of the backend I set via env:
Running the container manually via docker run and adding
Command used: |
Hi @EinAeffchen IMHO Since the errors are provided with some context, could you provide more context such host machine, architecture, OS and your docker commands to trigger these errors? Otherwise it is difficult to follow, to validate and provide further help. |
Hi @xemle, I assumed so too, but didn't want to leave anything untried. The machine I'm running this on:
Otherwise I started the system with the above docker-compose running the commands as described in your guide:
|
Hi @EinAeffchen thank you for the details. Currently I do not have a clue why the gallery on your side stuck. Which os architecture you are using? Do you run it on your bare metal or do you use any cloud provider? How much RAM does the ubuntu machine has? Have you tried a subset with disabled or the public api-server? I ran
from my Ubuntu 24.04 amd64 laptop with docker 26.1.2 and docker compose 26.1.2. It worked as expected. How can we proceed? Do you have further ideas? Anyway: thank you so much for your time and reports |
Hi @xemle, thanks for following up with me. I tried running the api on docker desktop for Windows and run into the exact same problem. However, removing the env variable completely worked on windows to get the api running. Though on my ubuntu machine this doesn't seem to work. I sadly never really worked with node.js to know anything about what might be going wrong here, though I'd assume the fact that it's running in docker should make it pretty much independent of where the docker installation itself is running. What's interesting however is that I seem to get different node.js versions depending on if I run the image on windows or on ubuntu:
Before when I posted this error it stated at the bottom that it was using Node.js 18.18? EDIT: So updating my docker version from ~20 to ~26 and using the new api image without setting an env seems to work! |
So your target host would be Windows? Have you tried the binary distribution of the gallery? ... and you would like to have your own api server locally running via WSL and docker?
Yes. I am trying to fix the CI jobs to build the docker images via github actions for #136. However somehow the jobs stucks while locally I can build the images. So now the node version is 20 LTS for the docker images if you build them from source. |
No no I just tried to run it on windows to see if the problem is my linux system. The target is linux. But as I wrote, with the new image and removing the BACKEND env variable from the api everything is running! The api crashes from time to time without any error, but a simple restart fixes that, which is enough for me for now. Thank you for your help! |
Hey,
so I tried setting up your system using the docker-compose guide. And I got the system running for a short while and can open it in the browser, however there is nothing to see and checking the logs I get the following error:
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at /app/node_modules/@home-gallery/storage/dist/write-storage-file.js:16:30
at /app/node_modules/@home-gallery/common/dist/fs/write-safe.js:15:7
at FSReqCallback.oncomplete (node:fs:192:23)
Node.js v18.20.2`
Logs from the gallery.log:
I am mounting a samba volume onto my machine and then mount it into docker. Though I don't assume that this is causing the problem as its able to see and process the images for a bit.
My docker-compose for reference:
The text was updated successfully, but these errors were encountered: