goniszewski / grimoire

Bookmark manager for the wizards 🧙
https://grimoire.pro
MIT License
2.12k stars 65 forks source link

Bookmark pictures not loading #99

Closed whereismyfun42 closed 6 months ago

whereismyfun42 commented 6 months ago

When logging into the app and waiting for the bookmarks to be shown - all of the bookmarks appear with an unloaded picture. Trying to open it up manually will result in a 500 error. The logs show this:

TypeError: fetch failed at node:internal/deps/undici/undici:12618:11 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async GET (file:///app/build/server/chunks/_server.ts-z21KZ-VH.js:6:20) at async render_endpoint (file:///app/build/server/index.js:391:20) at async resolve2 (file:///app/build/server/index.js:3661:22) at async Object.handle (file:///app/build/server/chunks/hooks.server--1Uz_Y0W.js:32:20) at async respond (file:///app/build/server/index.js:3555:22) at async Array.ssr (file:///app/build/handler.js:1243:3) { cause: Error: connect ECONNREFUSED 127.0.0.1:8090 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 8090 }

The instance is self-hosted in a container in Unraid, with Pocketbase, using the :latest tag for the container.

Steps to reproduce the behavior:

  1. Go to the local instance address and login with any user account (admin included)
  2. Wait for the bookmarks to be shown
  3. Observe that all the bookmarks are shown with broken pictures

Expected behavior Background pictures for bookmarks are loaded and shown

Screenshots bandicam 2024-04-30 20-50-41-995 bandicam 2024-04-30 20-50-46-372 bandicam 2024-04-30 20-50-49-862

Desktop (please complete the following information):

tamaskan commented 6 months ago

it's trying to connect to localhost, please post your configuration

whereismyfun42 commented 6 months ago

Ok, so as far as i understood - the main reason for this is definitely the Unraid setup... because the pocketbase is running in a separate container, and there are some issues with the grimoire trying to read the set environmental variables. Even if set the PUBLIC_POCKETBASE_URL to something - it still points to localhost:8090 (even if am actually not using 8090 port at all), I also tried setting the variable to actually use the 8090 port, but to no avail, cause it tries to call localhost, instead of my actually local IP from inside the container... my settings: bandicam 2024-05-01 22-13-35-422 bandicam 2024-05-01 22-14-47-572

It seemed to me that the problem may lie with the /src/lib/config.ts , cause its using the localhost:8090, but even changing the file to something like const config = { IS_DEV: import.meta.env.DEV, ORIGIN: env.PUBLIC_ORIGIN || getProcessEnvValue('PUBLIC_ORIGIN') || 'http://localhost:5173', POCKETBASE_URL: 'http://192.168.50.221:8090', HTTPS_ONLY: (env.PUBLIC_HTTPS_ONLY || getProcessEnvValue('PUBLIC_HTTPS_ONLY')) === 'true' || false, SIGNUP_DISABLED: (env.PUBLIC_SIGNUP_DISABLED || getProcessEnvValue('PUBLIC_SIGNUP_DISABLED')) === 'true' || false }; sadly did not help.

whereismyfun42 commented 6 months ago

Tried doing the docker-compose pipeline but received the same result - it still points to localhost:8090 even when the .env file assures otherwise

phampyk commented 6 months ago

I've been having the same issue and after a few hours I figured out why, it's trying to reach pocketbase in localhost:8090 but pocketbase localhost (as in, inside the docker internal network) should be using the port 80, not 8090. So grimoire is trying to reach the external port (8090) instead of the internal one (80).

As fas as I'm aware is a breaking change since 0.3.0 and I just didn't have the time until now to try and figure it out.

Either there should be a way for us to choose where we want to point our pockebase to, as we had before, or use the correct internal ports inside docker.

goniszewski commented 6 months ago

This was a bug introduced by a simple oversight on my part. It was fixed in https://github.com/goniszewski/grimoire/releases/tag/v0.3.5.

Sorry for your trouble!