Wasp client wasn't refreshing
I just had a scenario where I deployed a new version of my wasp app and I had to clear the browser cache to force load the new version. Does wasp have an internal solution that appends a unique identifier in the resulting builds so assets are refreshed every time? If not how to resolve?
5 Replies
Hi @Juan. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources, Wasp does handle asset versioning in production builds. When you import static assets in your application, Wasp (which uses Vite under the hood) will append a unique hash to the filename in production builds.
For example, as mentioned in the documentation:
In this case,
imgUrl
will be /img.png
during development, but will become /assets/img.2d8efhg.png
in the production build, where 2d8efhg
is a unique hash Static Asset Handling.
However, for the issue you're experiencing where you had to clear the browser cache after deployment, there are a few approaches you can take:
1. When deploying updates, make sure to properly rebuild your app with wasp build
before deploying Deploying Manually.
2. If you're using the Wasp CLI for deployment, you can use the wasp deploy fly deploy
command to update your deployed app with the latest changes Deploying with the Wasp CLI.
3. If you're still experiencing caching issues, you might need to use wasp clean
before rebuilding to remove all generated code and cached artifacts:
This will delete the .wasp/
directory and other cached artifacts CLI Reference.
If the issue persists, it might be related to how your specific deployment platform handles caching or how your browser is caching the application.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Juan, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?I'm using git actions, so the repository is always doing a fresh pull and wasp build every time it deploys. This might be tricky to resolve.
Hi @Juan, we use Vite with its default config regarding assets, so they are already being tagged with a hashed suffix, e.g. this is our example app:

I'd say this is probably a server configuration that is caching the
index.html
too strongly. We can't add a suffix there because the web server is looking for that specific file name.Gotcha. I'll see what I can do on my server.