You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two problems when deploying prerendered connect on Cloudflare Worker
During Build. The same CMS API endpoints can be called multiple times during the build returning the same data. I have made an internal cache during build time to stop this.
Run Time. Sometimes when user refreshes a page with the browser refresh button, the Cloudflare Worker, instead of just delivering the pre-render page, calls the CMS API. This can result in excessive API calls and large database egress. This cannot be solved with a server based cache, as Workers do not persist. I am using KV as the persistent cache. This is cleared a part of build process. However, it is not available for use during build process. So first time the Cloudflare Worker calls a prerendered API endpoint, it collects the data and puts it in the KV. Thereafter it collects data from KV.
The first is easy to solve oneself, but would be better if SvelteKit did it automatically.
The second seems a design issue with SvelteKit. I do not understand the need to 'refresh' prerender data. In any case, there should be some way of disabling this behaviour.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
There are two problems when deploying prerendered connect on Cloudflare Worker
During Build. The same CMS API endpoints can be called multiple times during the build returning the same data. I have made an internal cache during build time to stop this.
Run Time. Sometimes when user refreshes a page with the browser refresh button, the Cloudflare Worker, instead of just delivering the pre-render page, calls the CMS API. This can result in excessive API calls and large database egress. This cannot be solved with a server based cache, as Workers do not persist. I am using KV as the persistent cache. This is cleared a part of build process. However, it is not available for use during build process. So first time the Cloudflare Worker calls a prerendered API endpoint, it collects the data and puts it in the KV. Thereafter it collects data from KV.
Which problem does #14860 solve.
The first is easy to solve oneself, but would be better if SvelteKit did it automatically.
The second seems a design issue with SvelteKit. I do not understand the need to 'refresh' prerender data. In any case, there should be some way of disabling this behaviour.
Beta Was this translation helpful? Give feedback.
All reactions