Ravenous Part 4: Unhandled Rejection (TypeError): Cannot read property 'map' of undefined -

Great,
That’s all very helpful. And you are completely right about learning through mistakes and struggling to do projects - the sweat and tears are worth it in the end!!

Ok - I’ll check through again…
Many thanks for your help - you’ve been great - and very patient!

You’re welcome! Happy to help. I recently built an extensive API program so my apps could talk to my new API that then fetched data through another database and gave it back in a format the developer was expecting, so the developer could make requests in the same way they were used to and get data back in the same way they were used to but it got the data from a completely different place in a totally different format. APIs are fun when you get used to them but they can be very tricky!

Ps please can you tell me what my error is with the images - is it how it is written in Business.js? I thought maybe that should say image_url instead of imgSrc but that didn’t work.
And then that will be my last question - I promise!!

In yelp.js you are pulling the information you receive from yelp into your own object with your own names. When you get the image from yelp you are naming it imgSrc but later on in Business.js you are trying to call it with imageSrc.

Also, it’s worth noting that your bad api key and slight error calling an image with the wrong name aren’t coding errors! Your code is looking good. You are on the right track. =)

:+1: :+1: :+1: :heart:
Wish I could go out now to one of these places to celebrate :smile:

Haha, me too! Good job.

So I just spent the better part of 4 hours looking all over the web for a solution as I was getting the same error and tried a variety of things with no success. Then I saw the comment about not getting a response from Yelp API. So I opened my console and sure enough, I was getting the Error 400. So I scrutinized my Yelp.js file and the first thing I saw was that I had typed ‘sort_By’ instead of 'sortBy for my interpolated value. Still nothing… THEN I realized my interpolation wasn’t happening… I’m embarrassed to say that it took me all that time to realize I had used single quotes " ’ " instead of the interpolation ’ ` ’ to wrap my apiKey and my URL. As soon as I fixed that the project worked like a charm. Hopefully this will help anyone else that ends up here as I spent hours and hours trying to fix my code when this was the only issue I was having.

This thread helped guide me to console.log’s and the Developer’s tools to eventually find my error. Thanks for the help!