goniszewski / grimoire

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

Internal Server Error on User Registration in Development Mode #26

Closed ilovefreesw closed 11 months ago

ilovefreesw commented 12 months ago

Describe the bug

Internal Server Error on User Registration. The default admin and password in the env.docker are also not working

To Reproduce Steps to reproduce the behavior:

Run docker-compose --env-file .env.docker up

Sign up

And the error occurs.

Expected behavior

A user should be created with the supplied username and password.

Screenshots

image

Desktop (please complete the following information):

Additional context

ilfs@ilfs80:~/Public/grimoire$ docker compose --env-file .env.docker up
[+] Running 16/16
 ✔ pocketbase 3 layers [⣿⣿⣿]      0B/0B      Pulled                                                                              16.4s 
   ✔ 96526aa774ef Pull complete                                                                                                   3.5s 
   ✔ b81d65e74622 Pull complete                                                                                                   4.4s 
   ✔ a6035ffe0b8d Pull complete                                                                                                   7.8s 
 ✔ grimoire 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                                                       92.5s 
   ✔ 1f7ce2fa46ab Pull complete                                                                                                   8.4s 
   ✔ be65943961fd Pull complete                                                                                                   6.7s 
   ✔ deaa56ebdf84 Pull complete                                                                                                  13.4s 
   ✔ 75001c095b3d Pull complete                                                                                                  11.5s 
   ✔ 696f14a4770f Pull complete                                                                                                  12.1s 
   ✔ bcd4e171318c Pull complete                                                                                                  14.0s 
   ✔ e20100610709 Pull complete                                                                                                  30.2s 
   ✔ 912033d20149 Pull complete                                                                                                  18.2s 
   ✔ 4f4fb700ef54 Pull complete                                                                                                  16.5s 
   ✔ 86b0332a7a4b Pull complete                                                                                                  23.4s 
   ✔ ac31ac158758 Pull complete                                                                                                  20.9s 
[+] Running 3/3
 ✔ Network grimoire_default       Created                                                                                         0.2s 
 ✔ Container grimoire-pocketbase  Created                                                                                         6.5s 
 ✔ Container grimoire             Created                                                                                         1.9s 
Attaching to grimoire, grimoire-pocketbase
grimoire-pocketbase  | 2023/11/30 12:36:14 Server started at http://0.0.0.0:80
grimoire-pocketbase  | ├─ REST API: http://0.0.0.0:80/api/
grimoire-pocketbase  | └─ Admin UI: http://0.0.0.0:80/_/
grimoire             | Listening on 0.0.0.0:5173
grimoire             | Error: Not found: /favicon.ico
grimoire             |     at resolve (file:///app/build/server/index.js:3585:18)
grimoire             |     at resolve (file:///app/build/server/index.js:3412:34)
grimoire             |     at Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:26)
grimoire             |     at respond (file:///app/build/server/index.js:3410:43)
^CGracefully stopping... (press Ctrl+C again to force)
Aborting on container exit...
[+] Stopping 2/2
 ✔ Container grimoire             Stopped                                                                                        11.6s 
 ✔ Container grimoire-pocketbase  Stopped                                                                                         1.2s 
canceled

ilfs@ilfs80:~/Public/grimoire$ docker compose --env-file .env.docker up
[+] Running 2/2
 ✔ Container grimoire-pocketbase  Running                                                                                         0.0s 
 ✔ Container grimoire             Recreated                                                                                       1.0s 
Attaching to grimoire, grimoire-pocketbase
grimoire             | Listening on 0.0.0.0:5173
grimoire             | Error: Not found: /favicon.ico
grimoire             |     at resolve (file:///app/build/server/index.js:3585:18)
grimoire             |     at resolve (file:///app/build/server/index.js:3412:34)
grimoire             |     at Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:26)
grimoire             |     at respond (file:///app/build/server/index.js:3410:43)
grimoire             | ClientResponseError 0: Something went wrong while processing your request.
grimoire             |     at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
grimoire             |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |     at async default (file:///app/build/server/chunks/7-ca624c92.js:9:20)
grimoire             |     at async handle_action_request (file:///app/build/server/index.js:1072:18)
grimoire             |     at async render_page (file:///app/build/server/index.js:2508:23)
grimoire             |     at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |     at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |     at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |     at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |   url: '',
grimoire             |   status: 0,
grimoire             |   response: {},
grimoire             |   isAbort: false,
grimoire             |   originalError: TypeError: fetch failed
grimoire             |       at fetch (file:///app/build/shims.js:20346:13)
grimoire             |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |       at async default (file:///app/build/server/chunks/7-ca624c92.js:9:20)
grimoire             |       at async handle_action_request (file:///app/build/server/index.js:1072:18)
grimoire             |       at async render_page (file:///app/build/server/index.js:2508:23)
grimoire             |       at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |       at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |       at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |       at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |     cause: Error: connect ECONNREFUSED 127.0.0.1:8090
grimoire             |         at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
grimoire             |       errno: -111,
grimoire             |       code: 'ECONNREFUSED',
grimoire             |       syscall: 'connect',
grimoire             |       address: '127.0.0.1',
grimoire             |       port: 8090
grimoire             |     }
grimoire             |   }
grimoire             | }
grimoire             | ClientResponseError 0: Something went wrong while processing your request.
grimoire             |     at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
grimoire             |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |     at async default (file:///app/build/server/chunks/7-ca624c92.js:9:20)
grimoire             |     at async handle_action_request (file:///app/build/server/index.js:1072:18)
grimoire             |     at async render_page (file:///app/build/server/index.js:2508:23)
grimoire             |     at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |     at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |     at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |     at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |   url: '',
grimoire             |   status: 0,
grimoire             |   response: {},
grimoire             |   isAbort: false,
grimoire             |   originalError: TypeError: fetch failed
grimoire             |       at fetch (file:///app/build/shims.js:20346:13)
grimoire             |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |       at async default (file:///app/build/server/chunks/7-ca624c92.js:9:20)
grimoire             |       at async handle_action_request (file:///app/build/server/index.js:1072:18)
grimoire             |       at async render_page (file:///app/build/server/index.js:2508:23)
grimoire             |       at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |       at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |       at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |       at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |     cause: Error: connect ECONNREFUSED 127.0.0.1:8090
grimoire             |         at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
grimoire             |       errno: -111,
grimoire             |       code: 'ECONNREFUSED',
grimoire             |       syscall: 'connect',
grimoire             |       address: '127.0.0.1',
grimoire             |       port: 8090
grimoire             |     }
grimoire             |   }
grimoire             | }
grimoire             | ClientResponseError 0: Something went wrong while processing your request.
grimoire             |     at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
grimoire             |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |     at async default (file:///app/build/server/chunks/12-82d76df8.js:12:7)
grimoire             |     at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |     at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |     at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |     at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |     at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |   url: '',
grimoire             |   status: 0,
grimoire             |   response: {},
grimoire             |   isAbort: false,
grimoire             |   originalError: TypeError: fetch failed
grimoire             |       at fetch (file:///app/build/shims.js:20346:13)
grimoire             |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |       at async default (file:///app/build/server/chunks/12-82d76df8.js:12:7)
grimoire             |       at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |       at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |       at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |       at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |       at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |     cause: Error: connect ECONNREFUSED 127.0.0.1:8090
grimoire             |         at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
grimoire             |       errno: -111,
grimoire             |       code: 'ECONNREFUSED',
grimoire             |       syscall: 'connect',
grimoire             |       address: '127.0.0.1',
grimoire             |       port: 8090
grimoire             |     }
grimoire             |   }
grimoire             | }
grimoire             | ClientResponseError 0: Something went wrong while processing your request.
grimoire             |     at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
grimoire             |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |     at async default (file:///app/build/server/chunks/12-82d76df8.js:12:7)
grimoire             |     at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |     at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |     at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |     at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |     at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |   url: '',
grimoire             |   status: 0,
grimoire             |   response: {},
grimoire             |   isAbort: false,
grimoire             |   originalError: TypeError: fetch failed
grimoire             |       at fetch (file:///app/build/shims.js:20346:13)
grimoire             |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |       at async default (file:///app/build/server/chunks/12-82d76df8.js:12:7)
grimoire             |       at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |       at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |       at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |       at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |       at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |     cause: Error: connect ECONNREFUSED 127.0.0.1:8090
grimoire             |         at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
grimoire             |       errno: -111,
grimoire             |       code: 'ECONNREFUSED',
grimoire             |       syscall: 'connect',
grimoire             |       address: '127.0.0.1',
grimoire             |       port: 8090
grimoire             |     }
grimoire             |   }
grimoire             | }
grimoire             | ClientResponseError 0: Something went wrong while processing your request.
grimoire             |     at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
grimoire             |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |     at async default (file:///app/build/server/chunks/12-82d76df8.js:12:7)
grimoire             |     at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |     at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |     at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |     at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |     at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |   url: '',
grimoire             |   status: 0,
grimoire             |   response: {},
grimoire             |   isAbort: false,
grimoire             |   originalError: TypeError: fetch failed
grimoire             |       at fetch (file:///app/build/shims.js:20346:13)
grimoire             |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |       at async default (file:///app/build/server/chunks/12-82d76df8.js:12:7)
grimoire             |       at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |       at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |       at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |       at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |       at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |     cause: Error: connect ECONNREFUSED 127.0.0.1:8090
grimoire             |         at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
grimoire             |       errno: -111,
grimoire             |       code: 'ECONNREFUSED',
grimoire             |       syscall: 'connect',
grimoire             |       address: '127.0.0.1',
grimoire             |       port: 8090
grimoire             |     }
grimoire             |   }
grimoire             | }
grimoire             | ClientResponseError 0: Something went wrong while processing your request.
grimoire             |     at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
grimoire             |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |     at async default (file:///app/build/server/chunks/12-82d76df8.js:12:7)
grimoire             |     at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |     at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |     at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |     at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |     at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |   url: '',
grimoire             |   status: 0,
grimoire             |   response: {},
grimoire             |   isAbort: false,
grimoire             |   originalError: TypeError: fetch failed
grimoire             |       at fetch (file:///app/build/shims.js:20346:13)
grimoire             |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |       at async default (file:///app/build/server/chunks/12-82d76df8.js:12:7)
grimoire             |       at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |       at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |       at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |       at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |       at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |     cause: Error: connect ECONNREFUSED 127.0.0.1:8090
grimoire             |         at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
grimoire             |       errno: -111,
grimoire             |       code: 'ECONNREFUSED',
grimoire             |       syscall: 'connect',
grimoire             |       address: '127.0.0.1',
grimoire             |       port: 8090
grimoire             |     }
grimoire             |   }
grimoire             | }
goniszewski commented 12 months ago

Hello @ilovefreesw!

Which version of the app do you use? If not the most recent one, please pull the main branch, as it contains a fix for this very problem.

As for the initial admin credentials not working for user login, they shouldn't. As mentioned here, https://github.com/goniszewski/grimoire/issues/25.

ilovefreesw commented 12 months ago

Yes I run docker compose on the latest version. I think that uses the latest code. Still same error.

ilfs@ilfs80:~/grimoire$ docker compose up
[+] Running 16/16
 ✔ grimoire 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                                       117.7s 
   ✔ 1f7ce2fa46ab Pull complete                                                                                   27.7s 
   ✔ be65943961fd Pull complete                                                                                    4.9s 
   ✔ deaa56ebdf84 Pull complete                                                                                   21.1s 
   ✔ 75001c095b3d Pull complete                                                                                    9.5s 
   ✔ 696f14a4770f Pull complete                                                                                   12.6s 
   ✔ bcd4e171318c Pull complete                                                                                   15.0s 
   ✔ e20100610709 Pull complete                                                                                   66.4s 
   ✔ 912033d20149 Pull complete                                                                                   27.3s 
   ✔ 4f4fb700ef54 Pull complete                                                                                   30.3s 
   ✔ 86b0332a7a4b Pull complete                                                                                   57.7s 
   ✔ ac31ac158758 Pull complete                                                                                   35.3s 
 ✔ pocketbase 3 layers [⣿⣿⣿]      0B/0B      Pulled                                                               65.0s 
   ✔ 96526aa774ef Pull complete                                                                                   38.6s 
   ✔ b81d65e74622 Pull complete                                                                                   40.8s 
   ✔ a6035ffe0b8d Pull complete                                                                                   47.9s 
[+] Running 3/3
 ✔ Network grimoire_default       Created                                                                          0.2s 
 ✔ Container grimoire-pocketbase  Created                                                                          3.4s 
 ✔ Container grimoire             Created                                                                          0.5s 
Attaching to grimoire, grimoire-pocketbase
grimoire-pocketbase  | 2023/11/30 15:19:30 Server started at http://0.0.0.0:80
grimoire-pocketbase  | ├─ REST API: http://0.0.0.0:80/api/
grimoire-pocketbase  | └─ Admin UI: http://0.0.0.0:80/_/
grimoire             | Listening on 0.0.0.0:5173
grimoire             | ClientResponseError 404: The requested resource wasn't found.
grimoire             |     at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
grimoire             |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |     at async default (file:///app/build/server/chunks/12-82d76df8.js:14:7)
grimoire             |     at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |     at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |     at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |     at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |     at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |   url: 'http://pocketbase/api/collections/categories/records',
grimoire             |   status: 404,
grimoire             |   response: {
grimoire             |     code: 404,
grimoire             |     message: "The requested resource wasn't found.",
grimoire             |     data: {}
grimoire             |   },
grimoire             |   isAbort: false,
grimoire             |   originalError: {
grimoire             |     url: 'http://pocketbase/api/collections/categories/records',
grimoire             |     status: 404,
grimoire             |     data: {
grimoire             |       code: 404,
grimoire             |       message: "The requested resource wasn't found.",
grimoire             |       data: {}
grimoire             |     }
grimoire             |   }
grimoire             | }
grimoire             | ClientResponseError 404: The requested resource wasn't found.
grimoire             |     at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
grimoire             |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
grimoire             |     at async default (file:///app/build/server/chunks/12-82d76df8.js:14:7)
grimoire             |     at async handle_action_json_request (file:///app/build/server/index.js:997:18)
grimoire             |     at async resolve (file:///app/build/server/index.js:3524:24)
grimoire             |     at async Object.handle (file:///app/build/server/chunks/hooks.server-13110f1a.js:31:20)
grimoire             |     at async respond (file:///app/build/server/index.js:3410:22)
grimoire             |     at async Array.ssr (file:///app/build/handler.js:1221:3) {
grimoire             |   url: 'http://pocketbase/api/collections/categories/records',
grimoire             |   status: 404,
grimoire             |   response: {
grimoire             |     code: 404,
grimoire             |     message: "The requested resource wasn't found.",
grimoire             |     data: {}
grimoire             |   },
grimoire             |   isAbort: false,
grimoire             |   originalError: {
grimoire             |     url: 'http://pocketbase/api/collections/categories/records',
grimoire             |     status: 404,
grimoire             |     data: {
grimoire             |       code: 404,
grimoire             |       message: "The requested resource wasn't found.",
grimoire             |       data: {}
grimoire             |     }
grimoire             |   }
grimoire             | }
goniszewski commented 12 months ago

This error is different. The first one had code ECONNREFUSED trying to connect to PB instance on 127.0.0.1:8090. Now you're getting code 404 with message The requested resource wasn't found. which means, that either migrations from pb_migrations weren't run at all, or requests are not properly authenticated (more here https://github.com/pocketbase/pocketbase/discussions/2657#discussioncomment-6102632).

Can you check the following:

  1. If the HTTPS_ONLY variable is empty or set to false in env file?
  2. If you can, using your admin credentials, authenticate with PB (default URL: https://localhost:8090/_/ and verify that bookmarks, categories and tags collections exist. Moreover, under users collection, you should see a record related to the user.
tamaskan commented 12 months ago

Thats probably a stupid question, but isn't "pb_migrations" inside the .dockerignore preventing the migration-files from getting into the image ?

goniszewski commented 12 months ago

@tamaskan it's not a stupid question at all 😄 The pb_migrations dir is required for PocketBase image, and we're not building it. Grimoire's app image has no use for it.

goniszewski commented 12 months ago

@ilovefreesw I want to really, REALLY apologize to you for all the misinformation I wrote. It turns out, that the issues you had were caused by my previous changes that resulted in the env file not being read properly. It's now fixed with ec704b043760a3577404ecd6f264d5f88bbd03d4 and thoroughly tested.

Please tell me if it works for you with the latest changes!

tamaskan commented 12 months ago

Won't work for me, but i am using https in the front and http in the back (might be the cause) I think it is a little bit weird that you get a 500-error for every error (password-length + user already exists)

goniszewski commented 11 months ago

@tamaskan next version will include much better error handling for both app and forms. PR: https://github.com/goniszewski/grimoire/pull/27

babariviere commented 11 months ago

@goniszewski Installed your version and I still get 500 errors when logged in.

I have used your latest version (currently commit f64abc49ef75ec1947ffd866eb99da3983b088da).

Here is the steps to reproduce the issue:

  1. Clone the repo
  2. Copy .env.example into .env
  3. Run docker compose up -d
  4. Go to http://localhost:5173
  5. Click Sign-up
  6. Create user with username test and password test1234
  7. You get this error image

With this log:

handlePBError ClientResponseError 404: The requested resource wasn't found.
    at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async default (file:///app/build/server/chunks/12-14553d45.js:28:7)
    at async handle_action_json_request (file:///app/build/server/index.js:992:18)
    at async resolve (file:///app/build/server/index.js:3519:24)
    at async Object.handle (file:///app/build/server/chunks/hooks.server-3e813b3f.js:33:20)
    at async respond (file:///app/build/server/index.js:3405:22)
    at async Array.ssr (file:///app/build/handler.js:1221:3) {
  url: 'http://pocketbase/api/collections/categories/records',
  status: 404,
  response: {
    code: 404,
    message: "The requested resource wasn't found.",
    data: {}
  },
  isAbort: false,
  originalError: {
    url: 'http://pocketbase/api/collections/categories/records',
    status: 404,
    data: {
      code: 404,
      message: "The requested resource wasn't found.",
      data: {}
    }
  }
} true
  1. Click on login
  2. Try to login with username test and password test1234
  3. You get a 500 internal error with this log
User logged: test
User logged: test
ClientResponseError 404: The requested resource wasn't found.
    at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async load (file:///app/build/server/chunks/0-afd7bea8.js:44:22)
    at async load_server_data (file:///app/build/server/index.js:1187:18)
    at async file:///app/build/server/index.js:2558:18 {
  url: 'http://pocketbase/api/collections/categories/records?page=1&perPage=1000&expand=parent&filter=owner%3D%22gaso9xiznpphbyt%22&sort=name',
  status: 404,
  response: {
    code: 404,
    message: "The requested resource wasn't found.",
    data: {}
  },
  isAbort: false,
  originalError: {
    url: 'http://pocketbase/api/collections/categories/records?page=1&perPage=1000&expand=parent&filter=owner%3D%22gaso9xiznpphbyt%22&sort=name',
    status: 404,
    data: {
      code: 404,
      message: "The requested resource wasn't found.",
      data: {}
    }
  }
}
  1. You are now stuck in 500 loop until you clear cookies
babariviere commented 11 months ago

Also, trying out to login into http://localhost:5173/admin/login doesn't work at all. I get a 401 error with any credentials.

Do we have to create an admin user in pocketbase first before being able to use grimoire?

tamaskan commented 11 months ago

Same error, logged into pocketbase (had to create an admin-user) and no migrations were run (only user-collection with 1 entry)

tamaskan commented 11 months ago

Edit: had the same error, working now. I am using Portainer, so i had to copy the migration-files and use "pocketbase migrate --migrationsDir="/usr/local/bin/pb_migrations"" inside the pocketbase-container. And the pocketbase-container needs to load the .env-file too (the docker-compose is missing the "env_file: .env"-part)

goniszewski commented 11 months ago

@babariviere PocketBase needs to apply necessary migrations. Without this step, the app won't be able to connect to it.

Error with code 404 probably means that the PB doesn't see the provided token as valid. If PUBLIC_HTTPS_ONLY is not set to true, and both http://pocketbase:80 and http://localhost:8090 (with default config) fails the same, it may be the problem with PB configuration or missing migrations.

babariviere commented 11 months ago

@babariviere PocketBase needs to apply necessary migrations. Without this step, the app won't be able to connect to it.

Error with code 404 probably means that the PB doesn't see the provided token as valid. If PUBLIC_HTTPS_ONLY is not set to true, and both http://pocketbase:80 and http://localhost:8090 (with default config) fails the same, it may be the problem with PB configuration or missing migrations.

Migrations aren't automatically run? They are mount on a certain path in the docker-compose, I though it would automatically run them. Even running the pocketbase migrate command does nothing because I think the mount path is incorrect.

I think if we had just the bootstrap command for this, it would be enough for everyone to run it without friction.

goniszewski commented 11 months ago

The migrations are run automatically the first time PB is started. I have mentioned this specifically because there were attempts to run the app with only docker-compose.yml and .env file (so no pb_migrations in sight).

I am trying to improve and simplify the initialization process any chance I get. If I stumble upon a better solution, I will implement it 🙂

babariviere commented 11 months ago

I made a small fix to your docker-compose, the mount path was incorrect. That's probably why it wasn't working as expected.

mtsbh commented 10 months ago

Hello. I'm receiving the same error when I try to run the service.

Listening on 0.0.0.0:5173
ClientResponseError 0: Something went wrong while processing your request.
    at file:///app/node_modules/.pnpm/pocketbase@0.19.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31144
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async load (file:///app/build/server/chunks/0-e19feb09.js:34:24)
    at async load_server_data (file:///app/build/server/index.js:1187:18)
    at async file:///app/build/server/index.js:2558:18 {
  url: '',
  status: 0,
  response: {},
  isAbort: false,
  originalError: TypeError: fetch failed
      at fetch (file:///app/build/shims.js:20346:13)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async load (file:///app/build/server/chunks/0-e19feb09.js:34:24)
      at async load_server_data (file:///app/build/server/index.js:1187:18)
      at async file:///app/build/server/index.js:2558:18 {
    cause: Error: connect ECONNREFUSED 127.0.0.1:8090
        at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
      errno: -111,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '127.0.0.1',
      port: 8090
    }
  }
}

Firstly I build the latest branch with ./build.sh. It was succesfully completed:

[+] Building 173.7s (16/16) FINISHED                                                                                                             docker:default
 => [internal] load .dockerignore                                                                                                                          0.6s
 => => transferring context: 273B                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                       0.7s
 => => transferring dockerfile: 1.04kB                                                                                                                     0.1s
 => [internal] load metadata for docker.io/library/node:20-slim                                                                                            1.7s
 => [base 1/5] FROM docker.io/library/node:20-slim@sha256:2f451571a2e424b7aed654ca404331bf1ebf1ae3b4794bef0618d123d7a670e4                                 0.0s
 => [internal] load build context                                                                                                                          0.5s
 => => transferring context: 5.25MB                                                                                                                        0.3s
 => CACHED [base 2/5] RUN corepack enable                                                                                                                  0.0s
 => CACHED [base 3/5] RUN apt-get update && apt-get install -y python3 python3-pip                                                                         0.0s
 => [base 4/5] COPY . /app                                                                                                                                 2.0s
 => [base 5/5] WORKDIR /app                                                                                                                                1.2s
 => [prod-deps 1/1] RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile                                               66.0s
 => [build 1/2] RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile                                                          69.6s
 => [build 2/2] RUN pnpm run build                                                                                                                        82.7s 
 => [stage-3 1/3] COPY --from=prod-deps /app/node_modules /app/node_modules                                                                               13.0s 
 => [stage-3 2/3] COPY --from=build /app/build /app/build                                                                                                  1.9s 
 => [stage-3 3/3] COPY --from=build /app/package.json /app/package.json                                                                                    1.3s 
 => exporting to image                                                                                                                                     8.0s 
 => => exporting layers                                                                                                                                    7.8s 
 => => writing image sha256:12d7db5bf2970b6bf69db2b1bfb4c922f572c781bbd0778dce53c3be5d526f10                                                               0.1s 
 => => naming to docker.io/goniszewski/grimoire:latest   

After I tried docker-compose up -d command and I get error

ahbh@ubuntu-server:/media/hub/data/srv/grimoire$ docker-compose up -d                                                                                           
Creating network "grimoire_default" with the default driver                                                                                                     
Creating grimoire-pocketbase ... error

ERROR: for grimoire-pocketbase  Cannot start service pocketbase: error while creating mount source path '/media/hub/data/srv/grimoire/pb_data': chown /media/hub/data/srv/grimoire/pb_data: operation not permitted

ERROR: for pocketbase  Cannot start service pocketbase: error while creating mount source path '/media/hub/data/srv/grimoire/pb_data': chown /media/hub/data/srv/grimoire/pb_data: operation not permitted
ERROR: Encountered errors while bringing up the project.

tried the same second time and I get done

ahbh@ubuntu-server:/media/hub/data/srv/grimoire$ docker-compose up -d
Starting grimoire-pocketbase ... done
Creating grimoire            ... done

But when I try to access the URL, I get 500 Internal Error

I'm trying to run it like my other 10 docker containers with Caddy for reverse-proxy and Tailscale. I have an entry in my Caddyfile :

grim.ahbh.top {
        reverse_proxy http://localhost:5173
}

My .env file:

# Set it if you're using external PocketBase installation (default: http://localhost:8090)
# Example: PUBLIC_POCKETBASE_URL=https://grimoire.mydomain.com:8090
PUBLIC_POCKETBASE_URL=http://localhost:8090
# RECOMMENDED: Change this to your email
ROOT_ADMIN_EMAIL=user@email
# RECOMMENDED: Use a secure password. Can be later changed in PocketBase's admin panel
ROOT_ADMIN_PASSWORD=password
# Set this to your domain name (default: http://localhost:5173)
# Example: ORIGIN=grimoire.mydomain.com
ORIGIN=http://localhost:5173
# Set this to true if you're using HTTPS (default: false)
# Example: PUBLIC_HTTPS_ONLY=true
PUBLIC_HTTPS_ONLY=false
# Change to the port you want the app to listen on (default: 5173)
# Example: PORT=80
PORT=5173
# Set this to true if you want to disable public signups (default: false)
PUBLIC_SIGNUP_DISABLED=false

Am I doing something wrong? Because every other service I'm running is working with those steps.

tamaskan commented 10 months ago

"chown /media/hub/data/srv/grimoire/pb_data: operation not permitted" seems to be the issue