Deployment Issues

Just spent several very frustrating days trying to deploy my project to my domain, cantimaginewhy.com. Previously, I was using GitHub's gh-pages to deploy directly from my repo. But I also had this domain, on which I've been running a remarkably uninspired WordPress site for the past several years. Since my current hosting plan was set to expire today, I thought it would be a good time to launch my new React site.

Which ended up being more complicated than I anticipated. I mean, ultimately it was pretty simple, but it was one of those bugs that took a really long time to correctly diagnose. Transferring my domain from Bluehost to NameCheap was pretty simple - $12.95 for a one-year private domain registration. I configured the domain to use GitHub (complicated, but very well documented), but then when I tried opening the site in my browser, I got a blank screen. Which made me think I'd done the configuration wrong somehow, because it was running fine on localhost, and it had been running fine on GitHub before I moved the domain. In hindsight (hindsite?), the fact that the site title was correct should have tipped me off that it was the build, not the configuration, that was the problem. But instead I spent several hours setting and resetting A and CNAME records on NameCheap, before creating a Netlify account and trying to deploy from there instead (with identical results).

Whenever you're dealing with domain names, you technically have to wait up to 48 hours before you can be sure that whatever problem you're facing isn't just caused by slow DNS servers catching up to your changes. So I kept thinking I had to wait longer, even though I was actually seeing the name servers update within a minute or so of making changes (running 'dig cantimaginewhy.com' from terminal will show the current IP address).

Anyway, long story short, it was the "homepage" value in my package.json file. When moving from a site hosted on a subdirectory (acharliekelly.github.io/cantimaginewhy/) to one hosted on a naked domain (cantimaginewhy.com/), the resource path changes in a very important way (from '/static/' to './static/'). I hadn't noticed, because my local build was also in a folder called 'cantimaginewhy', so the same path worked for both builds. But as soon as I switched over to serving the site from a domain instead of a folder, referring to the '/static' folder stopped working. Hence, running it produced a page with the correct title, but otherwise blank, because none of the resources were loading. Probably would have figured that out sooner if I'd looked at the console, but I was convinced it had to be related to the configuration, since that was the main thing that changed.

But now it's running great from Netlify, which is a pretty nifty little service, considering that it's completely free and will rebuild every time I commit to my master branch on GitHub.

Comments

Popular posts from this blog

Basically done! (at least on full-screen. except for some issues.)

Getting back to it, again

Mobile Issues