Surreal
Surreal
NNuxt
Created by Surreal on 7/24/2024 in #❓・help
How to access buildId/build hash at runtime?
I've been trying to figure out how to access the build id/hash on the server side at runtime, so that I can build something from the client side to detect when a new version of my code has been released (e.g., expose the build hash via server API, periodically query it or build a websocket to monitor for change, etc.). Anyone know how to do this? The only things I've been able to find in this vein require either (1) hardcoding the buildId via config, or (2) intercepting, overriding, and storing the default hash generation in the "build:before" lifecycle hook. I'm hoping there's just a simpler, out-of-the-box way to access the existing generated ID. Thanks in advance!
3 replies
NNuxt
Created by Surreal on 5/22/2024 in #❓・help
How to get cookie value in SSR page?
I'm probably missing something, but I'm not understanding why I can't access a cookie value from a server-side rendered page. In a most basic sense, why doesn't {{ useCookie('foobar') }} show the value of that cookie in the server-side rendered HTML? It works correctly when the page is rendered client-side, and I can get the cookie value using getCookie() in a /server/api/ endpoint -- but I was under the assumption that useCookie is "SSR-friendly" and should be able to retrieve the cookie value for the server-rendered page?
6 replies