Version
alchemy@2.0.0-beta.66
The same behavior appears to be present on main.
What happened?
A Cloudflare Worker using directory assets without a caller-supplied hash always appears as changed in alchemy plan, even when the directory contents are unchanged.
For example:
yield* Cloudflare.Worker("Worker", {
main: "./src/worker.ts",
assets: {
directory: "./dist",
},
});
After deploying once, running alchemy plan again reports a Worker update.
readAssets calculates and stores a deterministic asset hash while applying the update, but the Worker diff returns changed when assets.hash is absent:
Expected behavior
When the Worker bundle, configuration, and asset directory contents are unchanged, alchemy plan should report a no-op without requiring the caller to implement separate directory hashing.
Current workaround
Supplying a deterministic assets.hash makes successive plans converge, but this requires duplicating asset hashing in application code.
Context
I encountered this while adding an Alchemy deployment path for Executor’s Cloudflare host. The host builds dist before each plan; even when two builds produce identical contents, the Worker still plans an update unless we supply assets.hash.
The current workaround computes a content hash for dist and passes it to the Worker:
UsefulSoftwareCo/executor#1510 (comment)
The review discussion concluded that Alchemy should ideally handle this and suggested opening this issue.
Version
alchemy@2.0.0-beta.66The same behavior appears to be present on
main.What happened?
A Cloudflare Worker using directory assets without a caller-supplied hash always appears as changed in
alchemy plan, even when the directory contents are unchanged.For example:
After deploying once, running
alchemy planagain reports a Worker update.readAssetscalculates and stores a deterministic asset hash while applying the update, but the Worker diff returns changed whenassets.hashis absent:readAssetscalculates the asset hashExpected behavior
When the Worker bundle, configuration, and asset directory contents are unchanged,
alchemy planshould report a no-op without requiring the caller to implement separate directory hashing.Current workaround
Supplying a deterministic
assets.hashmakes successive plans converge, but this requires duplicating asset hashing in application code.Context
I encountered this while adding an Alchemy deployment path for Executor’s Cloudflare host. The host builds
distbefore each plan; even when two builds produce identical contents, the Worker still plans an update unless we supplyassets.hash.The current workaround computes a content hash for
distand passes it to the Worker:UsefulSoftwareCo/executor#1510 (comment)
The review discussion concluded that Alchemy should ideally handle this and suggested opening this issue.