thombruce / toodles

✅ A super simple todo app
https://toodles.thombruce.com/
GNU General Public License v3.0
0 stars 0 forks source link

[Bug]: GitHub Pages deployment is blank #103

Closed thombruce closed 1 year ago

thombruce commented 1 year ago

What happened?

The GitHub Pages deployment appears blank, though the deploy.yml workflow is successful.

I am able to download the github-pages artifact as a zip file containing a tar archive. The tar archive appears to contain the correct build structure for the site. In other words, it appears the site is built correctly and the github-pages artifact contains the correct build.

After build, the site should be deployed to GitHub Pages... and it looks like it is. Console reports "Failed to load resource" errors associated with the JS files.

This would seem to indicate the site doesn't know where to find them, suggesting the TOODLES_BASE env variable is improperly configured in the code or is being missed.

Version

0.0.1 (Default)

What browsers are you seeing the problem on?

No response

Relevant log output

No response

Code of Conduct

thombruce commented 1 year ago

Problem almost certainly with this line in vite.config.ts:

{
  ...
  base: process.env.TOODLES_BASE || '/'
}

By hard-setting the value locally to '/toodles/' I can get most assets to generate properly (with <link rel="mask-icon" href="/maskable-icon-512x512.svg" color="#06b6d4"> being a possible exception - probably coming directly from the value set in src/index.html).

This doesn't necessarily explain why the actual vite build task is suddenly failing to pick up on the TOODLES_BASE var, but is a solid lead to investigate.

thombruce commented 1 year ago

I may also have assets generation setup incorrectly. See: https://vite-pwa-org.netlify.app/assets-generator/

thombruce commented 1 year ago

I don't think this solves the problem but it makes some meaningful changes that were safe to deploy on main: https://github.com/thombruce/toodles/commit/e527cd6762575826a4906bcec57ce9a2c6661fea

thombruce commented 1 year ago

878b14b788f1acdc502a96c86ec39589c19fdc6b and 957b5aed90bb281368f58eb79a34c0a11feaa7e0 feel like progress, but have made no change to the deployment. Perhaps because it is now self-referencing? I would have expected an error but... well, there is a logic to establishing an unset var in the interpretation of the YML and then setting it with the value, which would circumvent the existence of one in the settings. So it's possible...

In which case, go back to calling it "TOODLES_BASE" I guess.

thombruce commented 1 year ago

And damn, seemingly still no luck. It is as if this variable does not exist. I'll have to see if... what? I'm naming it or attempting to access it inappropriately?

thombruce commented 1 year ago

Resolved as of https://github.com/thombruce/toodles/commit/a5489f2e16473c1943b337651682f37d330eb2e0 (I was accessing the environment vars context incorrectly).

So I dunno if I want to revert some other decisions that were made... Probably not. I discuss above a potential issue with the Workflow var and the environment var sharing a name, so we'll leave the conversion to VITE_BASE in place... If it ain't broke...

Okay, closing as fixed.