goniszewski / grimoire

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

Cannot login as admin #109

Closed MichaelBrunn3r closed 1 month ago

MichaelBrunn3r commented 5 months ago

Describe the bug On a fresh install, I cannot login as the admin user or creat any other users. I just get the errors "Incorrect credentials" and "Incantation failed :(". I can log into Pocketbase admin panel with the same credentials.

Relevant logs:

> docker logs grimoire
ClientResponseError 504: Something went wrong while processing your request.
    at file:///app/node_modules/.pnpm/pocketbase@0.21.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:31966
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async AdminService.authWithPassword (file:///app/node_modules/.pnpm/pocketbase@0.21.0/node_modules/pocketbase/dist/pocketbase.es.mjs:1:10785)
    at async default (file:///app/build/server/chunks/6-UAsgIAkd.js:9:7)
    at async handle_action_request (file:///app/build/server/index.js:993:18)
    at async render_page (file:///app/build/server/index.js:2552:23)
    at async resolve2 (file:///app/build/server/index.js:3664:24)
    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) {
  url: 'http://localhost:5173/internal/pb/api/admins/auth-with-password',
  status: 504,
  response: {},
  isAbort: false,
  originalError: {
    url: 'http://localhost:5173/internal/pb/api/admins/auth-with-password',
    status: 504,
    data: {}
  }
}

To Reproduce docker-compose.yml

services:
  grimoire_pb:
    container_name: grimoire_pb
    image: spectado/pocketbase:0.22.10
    restart: unless-stopped
    ports:
      - '8090:80'
    volumes:
      - grimoire_pb_data:/pb_data
      - grimoire_pb_migrations:/pb_migrations/
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:80/api/health || exit 1
      interval: 5s
      timeout: 5s
      retries: 5
    env_file: .env
    depends_on:
      - grimoire

  grimoire:
    container_name: grimoire
    image: goniszewski/grimoire:latest
    restart: unless-stopped
    env_file: .env
    volumes:
      - grimoire_pb_migrations:/app/pb_migrations/
    build:
      context: .
      dockerfile: Dockerfile
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:$PORT/api/health || exit 1
      interval: 5s
      timeout: 5s
      retries: 5
    ports:
      - '$PORT:$PORT'

volumes:
  grimoire_pb_data:
    name: grimoire_pb_data
  grimoire_pb_migrations:
    name: grimoire_pb_migrations

.env

# Set it if you're using external PocketBase installation (default: http://pocketbase)
# Example: PUBLIC_POCKETBASE_URL=https://grimoire.mydomain.com:8090
PUBLIC_POCKETBASE_URL=
# RECOMMENDED: Change this to your email
ROOT_ADMIN_EMAIL=michaelbrunn3r@gmail.com
# RECOMMENDED: Use a secure password. Can be later changed in PocketBase's admin panel
ROOT_ADMIN_PASSWORD=password123
# Set this to your domain name (default: http://localhost:5173)
# Example: PUBLIC_ORIGIN=grimoire.mydomain.com
PUBLIC_ORIGIN=http://localhost:5173
# Set this to true if you're using HTTPS (default: false)
# Example: PUBLIC_HTTPS_ONLY=true
PUBLIC_HTTPS_ONLY=
# 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
goniszewski commented 5 months ago

Hello @MichaelBrunn3r! Are you able to sign in to the PocketBase with the credentials defined in your '.env' file? If not, it's possible the migrations failed (during which the admin account should be set up).

MichaelBrunn3r commented 5 months ago

Yes, this is a fresh install. If I open pocketbase in the browser, I can log in with the credentials provided in my .env. But the same credentials don't work in grimoire, which uses that pocketbase instance

reallemon commented 2 months ago

I'm also having this issue on a fresh install. I can log in on pocketbase, but it fails on grimoire. I'm also unable to create or log in to new users on grimoire, even if I make them in pocketbase first.

goniszewski commented 2 months ago

Hello @reallemon! I know this issue may be frustrating for you and for a good reason.

I would suggest you to use the preview version for now, that may require some polishing, but it's stable.

To use it, check the develop tag of Docker image. You won't need the envs for root admin and PB-related.

reallemon commented 2 months ago

I switched to that tag and branch, but now when I try to access the website I get a 500 error and the logs say " SQLiteError: no such table: user"

goniszewski commented 2 months ago

Thank you for bringing this issue to my attention! It's now fixed on develop branch. I have also spotted some UI issue with the filter/sort bar I'll should probably fix later today.

The docker-compose.yml file was also updated, and now it doesn't require the .env file at all.

reallemon commented 2 months ago

That's getting me in, though the environment variable wasn't working like I think it was supposed to and that was causing it to generate 404s.

    environment:
      - PORT=5173

This doesn't set an environment variable that docker compose can use, so these lines weren't working (docker said it was treating PORT as a blank string, which didn't seem to trigger the default options for me).

    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:$PORT/api/health || exit 1
      interval: 30s
      timeout: 10s
      retries: 3
    ports:
      - '${PORT:-5173}:${PORT:-5173}'

I just hard coded the ports and left the environment section in and that seemed to do the trick. That said, I'm having a lot of other errors. I'm able to create a user now and log in, but creating bookmarks is proving challenging. I'll make another issue for that though so I don't distract from this issue too much.

goniszewski commented 1 month ago

Please upgrade to the latest version of Grimoire. You can use the integrated migration tool to transfer your data to new format.