Overlooking mistakes pt.2

It really is true what they say when they tell you the majority of your time is debugging code and making it work, what ever it takes. Upon attempting to connect my front-end app to Heroku, I once again ran into a couple of problems. For one, when I tried to add my remote github link to my git remote branch, it wouldn’t work unless I had to clarify it again twice by copy pasting from my actual site. Another one that took me awhile was the fact that I couldn’t deploy my app to Heroku AT ALL. I kept getting the error “heroku pre receive hook declined” and so I had to Heroku log everythinggg to see what was up. I eventually had to get into my logs on my Heroku server and saw that maybe the solution was updating my node and adding the Heroku/node buildpack. And that is what I did.

This time I thoroughly remembered to git push all of my saved files. 2 hours later, deployment successful~ Lesson of the day: trust your logs. Every. Time.

Last but not least was the CORS problem. Knowing that my app is actually LIVE, I can’t just run CORS every time on a separate desktop because…well…that’s all local stuff. And doing that on a browser can lead to hackers invading your privacy and information.

It was an easy fix of adding app.use(cors()) along with:

app.use(function(req, res, next) {
res.header(“Access-Control-Allow-Origin”, “*”);
res.header(“Access-Control-Allow-Headers”, “Origin, X-Requested-With, Content-Type, Accept”);

Also installing cors once again to make sure and keep it updated helped.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s