My site is stored in Github, and linked to netlify with build hooks. So each time commits are pushed to “main”, netlify triggers a build.
I have been hosting my portfolio site here for a month or so, making new commits and deploying regularly. Everything has been working good until now.
I created a local feature branch. Then merged the feature into my local master branch. Everything went fine. Then I pushed the new master branch to “main” on github, and it triggered a Netlify build as usual.
However, for some reason this time it keeps getting stuck at this step:
success Writing page-data.json files to public directory - 0.005s - 8/8 1526.93/s
There is no build fail or error thrown. It just hangs here. Any idea what could be causing this? I looked for a way to clear the cache, such as with “gatsby clean”, however, I couldn’t find anything in the docs indicating that you guys have this feature.
Any help much appreciated!
**EDIT: ** The build did eventually fail with the following error:
What could it possibly be trying to process I wonder? All I added was the framer-motion dependency. That’s literally it. My build was only taking 1-2 minutes prior to that.
I think maybe I should create a new branch, revert back to the last commit that successfully built on Netlify, and have Netlify run a build from that branch instead of main. And see if it works.
This way I can determine for certain if the problem is something I did, or is caused by some change on Netlify’s end.
I understand that multiple issues could cause this “deploy hanging” issue. I’ll give you the issue in my case.
The problem for me was attempting to reference the window object in a custom React hook. I still don’t understand why the deploy is attempting to run this code, as it should only execute after hydrating on the client (I’m running Gatsby).
For some reason, I’m getting something akin to SSR behavior, when it should be SSG. The issue isn’t resolved, as the state is still not updating the screen width properly using the custom hook
Nonetheless, the deploy now works fine. So I can now begin troubleshooting the issue of detecting screen size using a custom react hook. This works fine locally. So, it’s a strange behavior for sure.