Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.