[Bug]: Could not connect to Discogs - HTTP 401
Before reporting
- [x] I am running the latest version of DVinyl.
- [x] I searched the existing issues and did not find a duplicate.
What happened?
I created a fresh Docker instance of the app and launched it using Docker Compose, without setting up a Discogs API token. I tried searching for an album and the UI returned "Could not connect to Discogs". The container logs only print "Search error for music: HTTP error! status: 401" every time I attempt a search.
I came back to the wiki and found that Discogs needs an API key for metadata, so I created an account and api key there. I validated that the key works with the Discogs API using the curl command they provide. I added the key to the .env file and restarted DVinyl, but every search still returns a 401 error in the logs. I don't believe it's a network issue on my part, because otherwise it would not be receiving a response from Discogs at all. Is there a way to enable more verbose logging to see what the response from the Discogs API is?
Steps to reproduce
- Create a new instance of DVinyl using the Docker Compose file and instructions
- Create and add a Discogs API key to the environment file
- Launch the appilcation
- Connect to the web UI
- Add a new record
- Search for any album
- UI shows "Could not connect to Discogs", logs show "Search error for music: HTTP error! status: 401"
Expected behavior
Album search shows actual results from Discogs.
DVinyl version
4.0.0
How are you running DVinyl?
Docker (pre-built image)
Affected media type or plugin
Music
Browser and device
Firefox on desktop
Logs or screenshots
[PluginRegistry] Registered item type Music
[PluginRegistry] Registered item type Book
[PluginRegistry] Registered item type Dvd
[PluginRegistry] Registered item type Game
[PluginRegistry] Registered item type Lego
[PluginRegistry] Registered item type BoardGame
[PluginRegistry] Registered item type Pokemon
[PluginRegistry] Registered item type Mtg
[PluginRegistry] Registered item type Yugioh
[PluginRegistry] Registered item type OnePiece
[PluginRegistry] Registered item type Lorcana
[PluginRegistry] Registered item type Swu
[PluginRegistry] Registered item type Digimon
[PluginRegistry] Registered item type Fab
[PluginLoader] Registered 14 plugin(s): music, books, dvd, games, lego, boardgames, pokemon, mtg, yugioh, onepiece, lorcana, swu, digimon, fab
[DB] Opening SQLite...
[DB] SQLite opened (/app/data/dvinyl.sqlite)
[BOOT] Running database migrations...
[BOOT] Syncing custom plugins...
[BOOT] Migrating custom field identities...
[BOOT] Server started on port 3099 (BASE_URL="/", env=development)
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
[SHUTDOWN] SIGTERM received, closing the database.
[PluginRegistry] Registered item type Music
[PluginRegistry] Registered item type Book
[PluginRegistry] Registered item type Dvd
[PluginRegistry] Registered item type Game
[PluginRegistry] Registered item type Lego
[PluginRegistry] Registered item type BoardGame
[PluginRegistry] Registered item type Pokemon
[PluginRegistry] Registered item type Mtg
[PluginRegistry] Registered item type Yugioh
[PluginRegistry] Registered item type OnePiece
[PluginRegistry] Registered item type Lorcana
[PluginRegistry] Registered item type Swu
[PluginRegistry] Registered item type Digimon
[PluginRegistry] Registered item type Fab
[PluginLoader] Registered 14 plugin(s): music, books, dvd, games, lego, boardgames, pokemon, mtg, yugioh, onepiece, lorcana, swu, digimon, fab
[DB] Opening SQLite...
[DB] SQLite opened (/app/data/dvinyl.sqlite)
[BOOT] Running database migrations...
[BOOT] Syncing custom plugins...
[BOOT] Migrating custom field identities...
[BOOT] Server started on port 3099 (BASE_URL="/", env=development)
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Search error for music: HTTP error! status: 401
Hey! Thanks for the detailed report :D
The first part is a bug on my side, sorry: without a Discogs token, the music module should tell you the key is missing instead of failing with a vague error. I'll fix that.
For the 401 with your key, my guess is the container never picked it up: a docker compose restart keeps the old environment, you need docker compose up -d for the .env change to be read. You can check with docker compose exec dvinyl-app printenv DISCOGS_TOKEN, it should print your token.
Let me know if that does it, thanks! ;)
Yep, that did it. I could have sworn I did the up -d after editing the .env file, but apparently not. Thanks!