{"record":{"id":"4faefae971173126","repo":"DIYgod/RSSHub","slug":"spotify-public-rss-is-disabled-due-to-the-lack-of","errorCode":null,"errorMessage":"Spotify public RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>","messagePattern":"Spotify public RSS is disabled due to the lack of <a href=\"https://docs\\.rsshub\\.app/deploy/config#route-specific-configurations\">relevant config</a>","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/spotify/utils.ts","lineNumber":8,"sourceCode":"import { config } from '@/config';\nimport ConfigNotFoundError from '@/errors/types/config-not-found';\nimport ofetch from '@/utils/ofetch';\n\n// Token used to retrieve public information.\nasync function getPublicToken() {\n    if (!config.spotify || !config.spotify.clientId || !config.spotify.clientSecret) {\n        throw new ConfigNotFoundError('Spotify public RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>');\n    }\n\n    const { clientId, clientSecret } = config.spotify;\n\n    const tokenResponse = await ofetch('https://accounts.spotify.com/api/token', {\n        method: 'POST',\n        headers: {\n            Authorization: `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`,\n            'Content-Type': 'application/x-www-form-urlencoded',\n        },\n        body: new URLSearchParams({\n            grant_type: 'client_credentials',\n        }).toString(),\n    });\n    return tokenResponse.access_token;\n}\n\n// Token used to retrieve user-specific information.","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/spotify/utils.ts#L1-L26","documentation":"Thrown as a ConfigNotFoundError from the getPublicToken() utility function when config.spotify is unset, or when config.spotify.clientId or config.spotify.clientSecret is missing. This function is called by Spotify routes that access public data (tracks, artists, playlists, shows) via the Spotify Web API using client-credentials OAuth flow. The clientId and clientSecret are obtained from the Spotify Developer Dashboard. ConfigNotFoundError signals to the user that operator configuration is required.","triggerScenarios":"Any Spotify public-data route is requested (e.g. /spotify/artist/:id, /spotify/playlist/:id) on an instance where SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET are not set. The error fires before any network call, at the token-acquisition step.","commonSituations":"Self-hosted RSSHub without Spotify credentials configured; the Spotify app credentials were revoked or rotated; or using a public instance that does not support Spotify routes.","solutions":["Create a Spotify app at https://developer.spotify.com/dashboard, copy the Client ID and Client Secret.","Set SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET in the RSSHub environment and restart.","If using Docker, pass the env vars via -e or docker-compose environment section.","If the credentials were revoked, regenerate them from the Spotify Developer Dashboard."],"exampleFix":"# before\n# (SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET not set)\n\n# after (.env)\nSPOTIFY_CLIENT_ID=your-client-id\nSPOTIFY_CLIENT_SECRET=your-client-secret","handlingStrategy":"validation","validationCode":"if (!config.spotify?.clientId || !config.spotify?.clientSecret) {\n    throw new ConfigNotFoundError('Spotify RSS requires SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET.');\n}","typeGuard":"function hasSpotifyPublicConfig(cfg: typeof config): cfg is typeof config & { spotify: { clientId: string; clientSecret: string } } {\n    return (\n        !!cfg.spotify &&\n        typeof cfg.spotify.clientId === 'string' &&\n        cfg.spotify.clientId.length > 0 &&\n        typeof cfg.spotify.clientSecret === 'string' &&\n        cfg.spotify.clientSecret.length > 0\n    );\n}","tryCatchPattern":null,"preventionTips":["Create a Spotify Developer app and set credentials during initial RSSHub deployment.","Document the Spotify Developer Dashboard setup steps in the route description.","Keep credentials secure in environment variables, never in source code."],"tags":["config","authentication","spotify","env-vars","oauth"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}