Can't load resource favicon.ico

Can't load resource favicon.ico
0.0 0

#1

Okay so for the API projects, I’ve been coding locally instead of on c9, and I figured I’d start deploying to heroku. I got my code to work on the local server but now, as I am deploying to heroku, it’s throwing a GET error for favicon.ico. With some reading, I found out that the browser automatically expects this file, but I never needed it before when testing my code. I even made a favicon.ico file and put in my directory and it’s still throwing an error. Any reason on why that is? Thanks.


#2

I am not sure but can you add new file called app.jsno in main app directory and inside that file

{
  "name": "project name",
  "description": "project description",
  "logo": "http://node-js-sample.herokuapp.com/node.svg",
  "image": "heroku/nodejs"
}

maybe this can solve your problem.


#3

Unless you need the favicon, I suggest getting a route to it and ending the request. Are you doing anything with the /: or /* route? I had a problem in the url shortener where is was converting the /* url to something else to work with my database and shortid, and ended up with the /* being /favicon.ico, which I erroneously tried to convert to something else. I fixed by ending or doing nothing with the /favicon.ico route before getting the / route.


#4

Thanks for the replies! After looking at the heroku logs, I actually don’t think it’s a problem with fetching the favicon.ico. It says it fails at the start script in the package.json file. The specific error is, “SyntaxError: missing ) after argument list”. I looked through the entire file and I couldn’t find any such error.


#5

Solved it! It was a problem with the port number. I was originally listening on port 8080 and after all the trouble, I decided to use process.env.PORT to let heroku choose the port number. Worked like a charm.