gokarna-theme / gokarna-hugo

A minimal opinionated theme for Hugo
https://gokarna-hugo.netlify.app
GNU General Public License v3.0
357 stars 139 forks source link

Failed to find a valid digest Error #215

Open dhje0ng opened 8 months ago

dhje0ng commented 8 months ago

I followed the procedure to build the gokarna theme and deployed it via Github, but I got a

I am getting hash related errors that do not occur with hugo server -D.

Also, as a result of these errors, the icons, pictures, etc. displayed by the theme are not displaying correctly.

Can you help me to resolve these errors?

demon-kr.github.io/:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://demon-kr.github.io/js/bundle.min.d751e63c00e1161a75e60eaf823256097427a013523377fb636f7605271f62a5.js' with computed SHA-256 integrity 'xg27Qi7QU7B2EWDjo/CLmvIGDwCtyPEsD/IajPVbPY4='. The resource has been blocked.
dhje0ng commented 7 months ago

This works fine if you change the following line to "" in themes/gokarna/layouts/partials/head.html.

My guess is that the integrity is not matching before and after the build.

<script src="{{ $jsBundle.RelPermalink }}" integrity=""></script>
526avijitgupta commented 7 months ago

Hi @dhje0ng thanks for reporting the issue.

Referencing the stack overflow post about the error, it seems like the integrity match could be failing due to Cloudfare config (see top voted answer).

We could make the integrity value as "" as a workaround but I'm not in favour of that since it would mean opening ourselves up for potential security vulnerabilities where the external resources could have changed.

I know this issue is resolved for you but would you mind checking if you have "Auto Minify" turned on if you're using Cloudfare (or any other provider)?

cc @yashmehrotra

dhje0ng commented 7 months ago

Hi @526avijitgupta

I'm deploying from Github Blog itself, without any external provider. Does this have anything to do with the HTTPS option provided by Github?

mansoorbarri commented 6 months ago

in my experience, this happens because the service providers keep a cache of the files including CSS files. This happens on Github pages as well; try clearing the cache and see if it helps.

dhje0ng commented 6 months ago
image image image

@526avijitgupta @mansoorbarri

DNS for my domain is Cloudflare. I tried disabling options related to optimisation or minification here and clearing the cache, but this did not solve the problem.

So far, there doesn't seem to be a better workaround for me other than patching the code with JS Integrity=""

If you have a specific workaround for these issues, could you please reply?