Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Asynchronous Programming with JavaScript Understanding Promises Handle Multiple Promises with Promise.all

Wikipedia Disambiguation page causes, "promises.js:47 TypeError: Cannot read property 'source' of undefined"... Fix?

So line 35: <img src=${person.thumbnail.source}> throws an error that causes only one with block to load on the page... The page works without the images, if I take the line out... I have had other problems with this error with this section. I've also seen some there people running into this as well, but haven't been able to find a good solution.

Also, please don't point me to the solution in the next section...(why did you wait to put it there?)

function generateHTML(data) {
  data.forEach( person => {
    const section = document.createElement('section');
    peopleList.appendChild(section);
    // Check if request returns a 'standard' page from Wiki
    if (person.type === 'standard') {
      section.innerHTML = `
        <img src=${person.thumbnail.source}>
        <h2>${person.title}</h2>
        <p>${person.description}</p>
        <p>${person.extract}</p>
      `;
    } else {
      section.innerHTML = `
        <img src="img/profile.jpg" alt="ocean clouds seen from space">
        <h2>${person.title}</h2>
        <p>Results unavailable for ${person.title}</p>
        ${person.extract_html}
      `;
    }
  });
}

It gave me three blocks with non-displayed images with alt text and descriptions like: Sergey Ryzhikov Results unavailable for Sergey Ryzhikov

Sergey Ryzhikov may refer to:

Sergey Ryzhikov (cosmonaut), Russian cosmonaut Sergey Ryzhikov (footballer), Russian football player

1 Answer

The course is being updated. Today Guil added changes that get it closer to what it is meant to be. Unfortunately the api that list the people on the ISS gives names that are not compatible/specific enough to target the wiki api summary pages for all of the crew. I was trying to figure out how to add the term "naut" or "ISS" to assist the wiki api targeting but have moved on at this point.