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
After adding a Redis cache with yarn rw setup cache redis, whenever I try to run a yarn rw build, it will hang after the prerendering. The build never finishes and no errors are thrown.
How do we reproduce the bug?
Spin up a new application with Redwood 7.0.6 and some prerendered routes
Run a yarn rw build to confirm successful build
Follow the documentation for adding a Redis cache with yarn rw setup cache redis
You will have a /api/src/lib/cache.ts file similar to:
import{createCache,InMemoryClient,RedisClient,}from'@redwoodjs/api/cache'import{logger}from'./logger'exportletclient: InMemoryClient|RedisClientif(process.env.NODE_ENV==='test'){client=newInMemoryClient()}else{try{client=newRedisClient({url: process.env.CACHE_HOST, logger })}catch(e){logger.error(`Could not connect to cache: ${e.message}`)}}exportconst{ cache, cacheFindMany, cacheClient, deleteCacheKey }=createCache(client,{
logger,timeout: 500,})
Run a yarn rw build which will hang after the prerendering and never finish
Simple fix
In your /api/src/lib/cache.ts file, update the following line:
- if (process.env.NODE_ENV === 'test') {+ if (process.env.NODE_ENV === 'test' || process.env.__REDWOOD__PRERENDERING === '1') {
Run a yarn rw build and it should finish successfully
What's not working?
After adding a Redis cache with
yarn rw setup cache redis
, whenever I try to run ayarn rw build
, it will hang after the prerendering. The build never finishes and no errors are thrown.How do we reproduce the bug?
yarn rw build
to confirm successful buildyarn rw setup cache redis
/api/src/lib/cache.ts
file similar to:yarn rw build
which will hang after the prerendering and never finishSimple fix
/api/src/lib/cache.ts
file, update the following line:yarn rw build
and it should finish successfullyWhat's your environment? (If it applies)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: