diff --git a/src/backend/metadata/tmdb.ts b/src/backend/metadata/tmdb.ts index 2bae75d1..b143b312 100644 --- a/src/backend/metadata/tmdb.ts +++ b/src/backend/metadata/tmdb.ts @@ -144,12 +144,16 @@ export function decodeTMDBId( const baseURL = "https://api.themoviedb.org/3"; +const apiKey = conf().TMDB_READ_API_KEY; + const headers = { accept: "application/json", - Authorization: `Bearer ${conf().TMDB_READ_API_KEY}`, + Authorization: `Bearer ${apiKey}`, }; async function get(url: string, params?: object): Promise { + if (!apiKey) throw new Error("TMDB API key not set"); + const res = await mwFetch(encodeURI(url), { headers, baseURL,