Already usable?
appinteractive opened this issue ยท 5 comments
Hey just testing that package with Vercel and asked myself it this will become a usable module or if you have any planes with this package. Thanks by the way!
Hi @appinteractive Actually this is a POC to make a cloud-agnostic solution similar to versel SPR. But of course will be eventually a usable nuxt module :)
Current version is in-memory cache. But you can modify module to set headers for vercel
I tried it just now. It disables the Vercel Compression (br
, gzip
).
Proper vertical support is still in roadmap meanwhile you can try the solution with nuxt/vercel-builder#37 (comment).
More clarification: Vercel does cache on edge level using Cache-Control
and X-version
response hints which is not supported out-of-the-box everywhere. The current implementation is generic enough to be used everywhere but a refactor is needed to abstract and support headers-only for proper vercel support.
It disables the Vercel Compression (br, gzip)
As a quick fix we may need to send Content-Type
and Etag
here
I was playing around with this module and it seems to work fine, but what I noticed is that this line:
const { html } = await this.nuxt.renderRoute(cacheItem.url, {});
throws errors if you use context.req
anywhere, for example in the store like I do:
async nuxtServerInit({ dispatch, commit }, { req, $config, error }) {
const isMarketplace = req
? req.headers['x-marketplace'] === 'true'
: false;
}
I get Cannot read property headers of undefined
thrown from the vue-server-renderer. When I null-checked all of those it worked fine!