Users see old cached version of apps after new version is deployed #894

Open
opened 2024-07-25 18:23:47 +00:00 by dboreham · 7 comments
Owner

I made a release in the test-pwa repo with a new version number. The deployment succeeded, but the deployed app has an old config value (should equal the current version number: 1.42).

image
I made a release in the test-pwa repo with a new version number. The deployment [succeeded](https://git.vdb.to/cerc-io/test-progressive-web-app/actions/runs/49), but the deployed app has an old config value (should equal the current version number: 1.42). <img width="293" alt="image" src="attachments/3cdfb9bd-7010-4216-a5fb-8d2a8cf9eb16">
6.1 KiB
telackey was assigned by dboreham 2024-07-25 18:23:53 +00:00
Member

Hmm
image

Hmm <img width="458" alt="image" src="attachments/186882bb-04fb-44c6-a8c1-f7e8b313fefc">
6.9 KiB
Member

Loading with an "InPrivate" window produces the correct output every time, so it seems to be a cache-related bug rather than a deployment one.

Loading with an "InPrivate" window produces the correct output every time, so it seems to be a cache-related bug rather than a deployment one.
Member

related to #855?

related to #855?
dboreham changed title from Deploying test-pwa does not produce correct config to Users see old cached version of apps after new version is deployed 2024-07-25 18:41:55 +00:00
Author
Owner

Expected outcome:

I deploy a new version of my webapp -> users of that webapp get the new version without needing to do anything unusual like open an incognito window.

Actual outcome:

That doesn't happen.

Expected outcome: I deploy a new version of my webapp -> users of that webapp get the new version without needing to do anything unusual like open an incognito window. Actual outcome: That doesn't happen.
Owner

We may want to solve this in the template app but this sort of cache invalidation seems out of scope for the moment. I assume force reloading the page in the browser or clearing the cache fixes the problem.

We may want to solve this in the template app but this sort of cache invalidation seems out of scope for the moment. I assume force reloading the page in the browser or clearing the cache fixes the problem.
Member

my workaround has been to change "name": @name-authority/change-me in the package.json with every new deployment

my workaround has been to change `"name": @name-authority/change-me` in the `package.json` with every new deployment
Author
Owner

This turns out to only affect web app config (environment variables). The app code itself is not stale.
The cause is a bug in nextjs -- it has a scheme for generating file names from the hash of the content, but in the way we're using next (the two-stage build process) they forget to include config files in this scheme. So the file gets served to the browser as "cache this forever".
Then browsers seem to be brain-dead in that even if you force-reload (which works -- new content), it doesn't invalidate the stale cached content. So the next time you open the app, you get the old config.

Now that we understand what's happening, reducing the priority on this. Force-reload as a workaround for now.

This turns out to only affect web app config (environment variables). The app code itself is not stale. The cause is a bug in nextjs -- it has a scheme for generating file names from the hash of the content, but in the way we're using next (the two-stage build process) they forget to include config files in this scheme. So the file gets served to the browser as "cache this forever". Then browsers seem to be brain-dead in that even if you force-reload (which works -- new content), it doesn't invalidate the stale cached content. So the next time you open the app, you get the old config. Now that we understand what's happening, reducing the priority on this. Force-reload as a workaround for now.
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/stack-orchestrator#894
No description provided.