Yooooomi / your_spotify

Self hosted Spotify tracking dashboard
GNU General Public License v3.0
2.64k stars 108 forks source link

[Error] Unable to login - User validation failed: settings.dateFormat: Path `settings.dateFormat` is required. #381

Closed armaatus closed 3 months ago

armaatus commented 3 months ago

Describe the bug

The site redirects to the login page every time I click on login.

Additional context Docker compose I use I'm using mongo 4.4, because CPU has no AVX

version: "3"

services:
 server:
    image: yooooomi/your_spotify_server
    restart: always
    ports:
      - "8080:8080"
    links:
      - mongo
    depends_on:
      - mongo
    environment:
      API_ENDPOINT: [a cloudflare tunnel link]
      CLIENT_ENDPOINT: [a cloudflare tunnel link]
      SPOTIFY_PUBLIC: 
      SPOTIFY_SECRET: 

    networks:
      - spotify_network

 mongo:
    container_name: mongo
    image: mongo:4.4
    volumes:
      - ./your_spotify_db:/data/db
    networks:
      - spotify_network

 web:
    image: yooooomi/your_spotify_client
    restart: always
    ports:
      - "3000:3000"
    environment:
      API_ENDPOINT: [a cloudflare tunnel link]
    networks:
      - spotify_network

networks:
 spotify_network:

Error message I get in server docker logs

GET /oauth/spotify 302 11.714 ms - 826
[error]  Error: User validation failed: settings.dateFormat: Path `settings.dateFormat` is required.
    at ValidationError.inspect (/app/node_modules/mongoose/lib/error/validation.js:50:26)
    at formatValue (node:internal/util/inspect:805:19)
    at inspect (node:internal/util/inspect:364:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2298:40)
    at formatWithOptions (node:internal/util/inspect:2160:10)
    at console.value (node:internal/console/constructor:351:14)
    at console.warn (node:internal/console/constructor:384:61)
    at Object.error (/app/apps/server/lib/tools/logger.js:19:82)
    at /app/apps/server/lib/routes/oauth.js:93:25
    at Generator.throw (<anonymous>) {
  errors: {
    'settings.dateFormat': ValidatorError: Path `settings.dateFormat` is required.
        at validate (/app/node_modules/mongoose/lib/schemaType.js:1367:13)
        at SchemaType.doValidate (/app/node_modules/mongoose/lib/schemaType.js:1351:7)
        at /app/node_modules/mongoose/lib/document.js:2982:18
        at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
      properties: [Object],
      kind: 'required',
      path: 'settings.dateFormat',
      value: undefined,
      reason: undefined,
      [Symbol(mongoose#validatorError)]: true
    }
  },
  _message: 'User validation failed'
}

Extra information

Looks like that all connections between server, web and mongo work. Only problem is that when I click on the login button I get this error in the server docker logs and get redirected again to the login page.

Yooooomi commented 3 months ago

Hello! Did it run migrations successfully?

armaatus commented 3 months ago

This is what the logs say

[info]  Trying to connect to database at mongodb://mongo:27017/your_spotify
[info]  Connected to database !
[info]  Cannot read migrations from database. If this is the first time you run migrations, then this is normal.
[info]  Checking database for missing track data...
[warn]  No user is admin, cannot auto fix database
[info]  Starting migrations
[info]  Running migration: Global preferences
[info]  Running migration: nb elements in user
[info]  Running migration: add best metric
[info]  Running migration: switch to spotify login
[info]  Running migration: add admin role
[info]  Running migration: add dark mode
[info]  Running migration: fixing first listened at
[info]  Running migration: create private data
[info]  Running migration: add metadata to infos
[info]  Checking database for missing track data...
[warn]  No user is admin, cannot auto fix database
[info]  Running migration: add date format to user
[info]  Migrations successfully ran
Yooooomi commented 3 months ago

If you don't see errors it's ok I guess. Is it a new account?

Yooooomi commented 3 months ago

If it's a new account I see where the problem is. I fix this when I get home, should be okay in an hour or two. Sorry for the bug, might have overlooked account creation when adding the date format feature.

sherman1992 commented 3 months ago

I can confirm I'm having the same issue with a new account.

Yooooomi commented 3 months ago

Fixed in latest release 1.10.1 in #382