Film finder project debugging - help please?

https://www.codecademy.com/courses/learn-intermediate-javascript/projects/js-film-finder

Hi everyone - thank you in advance for reviewing my question/code. I’m debugging JS Film Finder project and down to the last errors, asking for some help on the below code for reference error tmdbBaseURL not defined at getMovieInfo js:44? Also No eval config to sync and uncaught DOMException?? Many thanks for all replies!! Totally OTL at the end here.

const tmdbKey = ‘c1233156546456456456456464566’;

const tmdbBaseUrl = ‘https://api.themoviedb.org/3’;

const playBtn = document.getElementById(‘playBtn’);

const getGenres = async () => {

const genreRequestEndpoint = ‘/genre/movie/list’;

const requestParams = ?api_key=${tmdbKey};

const urlToFetch = ${tmdbBaseUrl}${genreRequestEndpoint}${requestParams};

try {

const response = await fetch(urlToFetch);

if (response.ok){

const jsonResponse = await response.json();

const genres = jsonResponse.genres;

return genres;

}

} catch (error) {

console.log(error);

};

};

const getMovies = async () => {

const selectedGenre = getSelectedGenre();

const discoverMovieEndpoint = ‘/discover/movie’;

const requestParams = ?api_key=${tmdbKey}&?with_genre=${selectedGenre};

const urlToFetch = ${tmdbBaseUrl}${discoverMovieEndpoint}${requestParams};

try {

const response = await fetch (urlToFetch);

if (response.ok){

const jsonResponse = await response.json();

const movies = jsonResponse.results;

return movies;

}

} catch (error){

console.log(error);

};

};

const getMovieInfo = async (movie) => {

const movieId = movie.id;

const movieEndpoint = /movie/${movieId};

const requestParams = ?api_key=${tmdbKey};

const urlToFetch = ${tmdbBaseURL}${movieEndpoint}${requestParams};

try{

const response = await fetch(urlToFetch);

if (response.ok){

const jsonResponse = await response.json();

const movieInfo = jsonResponse;

return movieInfo;

}

} catch (error) {

console.log(error);

}

};

Apologies, the exact errors as follows:

trackConsoleError.js:25 No eval config to sync
(anonymous) @ trackConsoleError.js:25
www-widgetapi.js:1004 Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://www.youtube.com’) does not match the recipient window’s origin (‘https://www.codecademy.com’).
p.sendMessage @ www-widgetapi.js:1004
p.ab @ www-widgetapi.js:1001
script.js:44 Uncaught (in promise) ReferenceError: tmdbBaseURL is not defined
at getMovieInfo (script.js:44:22)
at HTMLButtonElement.showRandomMovie (script.js:66:24)

It seems to be a spelling issue:
tmdbBaseUrl originally, but tmdbBaseURL on line 41 (in the the getMovieInfo function).

2 Likes