I have been working on deploying my Fresh application using the new ahead-of-time builds to optimize static assets in advance. I've successfully followed the guidelines provided on the documentation site and everything is working well on my local setup.
However, when attempting to deploy on Deno Deploy, the deployment process fails at the Build step (when running deno task build
).
The error message causing this issue is as follows:
error: The source code is invalid, as it does not match the expected hash in the lock file. Specifier: https://esm.sh/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dbaba9bebab8af9beaebf5eaeef5ea">[email protected]</a>/debug
.
Upon conducting some research, it appears that esm.sh imports preact
dependencies using different build versions, resulting in a failed integrity check. The suggested solution is to pin the versions in the deno.json
file, but this approach doesn't seem to work for me or perhaps I am missing something.
Here are the relevant import sections from my deno.json
file:
"imports": {
"preact": "https://esm.sh/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="96e6e4f3f7f5e2d6a7a6b8a7a3b8a7">[email protected]</a>?pin=v122",
"preact/": "https://esm.sh/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86f6f4e3e7e5f2c6b7b6a8b7b3a8b7">[email protected]</a>/",
"preact-render-to-string": "https://esm.sh/*<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="661614030705124b1403080203144b12094b1512140f0801265048544857">[email protected]</a>?pin=v122",
"@preact/signals": "https://esm.sh/*@preact/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="73001a141d121f0033425d425d40">[email protected]</a>",
"@preact/signals-core": "https://esm.sh/*@preact/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f5869c929b949986d8969a8790b5c4dbc7dbc6">[email protected]</a>",
}
This is the command used for the build task:
deno run -A dev.ts build --lock=deno.lock --lock-write
Any suggestions on how to resolve this issue?