Skip to content

fix: prevent crash when new releases contain geo-blocked albums#287

Merged
bambanah merged 2 commits intobambanah:mainfrom
dierigoletto:fix/newreleases-crash-unavailable-track
Mar 26, 2026
Merged

fix: prevent crash when new releases contain geo-blocked albums#287
bambanah merged 2 commits intobambanah:mainfrom
dierigoletto:fix/newreleases-crash-unavailable-track

Conversation

@dierigoletto
Copy link
Copy Markdown
Contributor

@dierigoletto dierigoletto commented Mar 22, 2026

What's the problem?

When Deezer's new releases feed contains albums that are geo-blocked in your region, getAlbumDetails() throws a GWAPIError: Track unavailable on Deezer. This was an unhandled Promise rejection that crashed the entire deemix process.

The crash shows up in logs like this:

[error] unhandledRejection: Track unavailable on Deezer
GWAPIError: Track unavailable on Deezer
    at GW.api_call (file:///app/packages/deezer-sdk/dist/index.js:1224:13)
    at async getAlbumDetails (file:///app/packages/webui/dist/routes/api/get/albumSearch.js:43:20)
    at async Promise.all (index 35)
    at async handler (file:///app/packages/webui/dist/routes/api/get/newReleases.js:32:20)

After the crash, deemix restarts and the next /api/newReleases call crashes it again.

What's the fix?

Each album is now fetched individually with a .catch(), so geo-blocked albums are silently skipped (with a console.warn) instead of bringing down the whole server. The response just omits the unavailable albums.

const albumResults = await Promise.all(
    recent.map((c: any) =>
        getAlbumDetails(dz, c.ALB_ID).catch((err: Error) => {
            console.warn(`[newReleases] Skipping album ${c.ALB_ID}: ${err.message}`);
            return null;
        })
    )
);
const albums = albumResults.filter((a) => a !== null);

How was this tested?

Tested locally with a deemix Docker container (ghcr.io/bambanah/deemix:latest). Before the fix, any call to /api/newReleases from the Lidarr deemix plugin crashed the process. After patching the compiled dist/newReleases.js and restarting the container, deemix stayed up and the Lidarr indexer worked correctly.

Related: There is a corresponding PR on the Lidarr deemix plugin side that avoids calling /api/newReleases altogether during indexer setup: dierigoletto/Lidarr.Plugin.Deemix: fix/newreleases-crash-unavailable-track. Both fixes together make the integration robust.

When Deezer's new releases feed contains geo-blocked tracks,
getAlbumDetails() throws a GWAPIError. This unhandled rejection
crashed the entire deemix process. Now each album is fetched
individually with a .catch(), so unavailable albums are skipped
with a warning instead of bringing down the server.
@dierigoletto dierigoletto requested a review from bambanah as a code owner March 22, 2026 12:53
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 22, 2026

🦋 Changeset detected

Latest commit: 7b2a7b7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
deemix-webui Patch
deemix-gui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@bambanah
Copy link
Copy Markdown
Owner

Thanks for the PR! Can you please add a changeset (pnpm changeset) with your changes so that this can be released?

@bambanah bambanah merged commit 72b17d0 into bambanah:main Mar 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants