476192 (5) [Avatar] Offline
#1
Hi,

I am having an issue after deploying to Heroku and I was wondering if anyone else has encountered the same. On localhost my app appears to be working fine, save for a few minor glitches like being unable to change the lng/lat coords without getting an error. On Heroku however, I am getting the "Api Lookup Error" warning. This has been puzzling me for a while now and I have no idea as to why this is happening.

Thanks in advance to anyone who can offer up some insight(s).

Cheers-
simon.holmes (148) [Avatar] Offline
#2
Hi

Are you still getting the problem?

I presume the error is showing in the browser? Which stage of the book are you at? Is mLab set up correctly, and your app pointing to that instead of localhost?

Thanks
Simon
476192 (5) [Avatar] Offline
#3
Hi Simon,

Thanks for responding!

I came across this error towards the end of chapter 7 (after deploying to Heroku). I have two databases set up: one locally and one via mLab. I can see that my database has been transferred to mLab successfully and that my config variables (via Heroku) have been set up. I cannot seem to figure out what's missing in my code. There is no "api lookup error" when I run npm start locally, only after deployment to Heroku. This leads me to think that I must have made a mistake somewhere in the deployment process via the command line, but I'm not sure. I did set up a variables.env file to hide the database urls, but from my understanding Heroku does not read environment variables, so I wouldn't think (but at the same time I'm not sure) this would be the cause of the error.

I've decided to dive into chapter 8 regardless in the meantime. I'm enjoying the book so far. With any luck, this issue will resolve itselt down the line as I compare my code to the code in chapter 8. ...must be something that I've missed along the way.

Have you encountered this issue before?

Cheers and thanks againsmilie

Juliette
simon.holmes (148) [Avatar] Offline
#4
Hi Juliette

I haven't come across this problem before.

After starting up the app in Heroku, can you check the logs? The Mongoose connection events should output a log saying which database it has connected to, or if it has failed.

You can see the logs in terminal with this command:

heroku logs


Thanks
Simon
476192 (5) [Avatar] Offline
#5
Hi Simon,

I got it working. I had the wrong MongoDB/mLab url (oops!).

Thanks for the tip!

Cheerssmilie

Juliette
536434 (1) [Avatar] Offline
#6
Hi,

I got the same problem, but locally (didn't even try sending it to heroku). I reached this problem at page 213 and I thought I did something wrong, so I tried with the chapter 7 git, but I still have the issue.

Alain

Edit: ignore me, with the files in the git it worked. Will check what didnt work earlier.
577929 (1) [Avatar] Offline
#7
Hello,
I have the same problem on localhost.
You said you had resolved that issue. Can you tell me how? It throws me that error : "API lookup error", maybe because of this:
var renderHomepage = function(req, res, responseBody){
var message;
if (!(responseBody instanceof Array)) {
message = "API lookup error";
responseBody = [];
.......

It seems that the program doesn't recognize responseBody as an Array.
Please help me and tell me how did you solve this issue.
PS: I have compared my files with those posted on git, chapter 7 and they are the same.