Workers "Build Cache" not working in monorepos + pnpm

I have a monorepo, setup with Turborepo with the following structure
├── apps
│ ├── api (Hono)
│ │ └── package.json
│ ├── app (React Router 7)
│ │ └── package.json
│ └── web (React Router 7)
│ └── package.json
├── package.json
├── packages
└── services
├── apps
│ ├── api (Hono)
│ │ └── package.json
│ ├── app (React Router 7)
│ │ └── package.json
│ └── web (React Router 7)
│ └── package.json
├── package.json
├── packages
└── services
api, app, and web are separate workers each with Build Cache enabled, and appropriate Root Directory set in their Build Configuration. Here’s an example of the build configuration for app:
Build: pnpm build -m production
Deploy: npx wrangler deploy --keep-vars
Root directory: /apps/app
Build: pnpm build -m production
Deploy: npx wrangler deploy --keep-vars
Root directory: /apps/app
Here are the related build variables for app:
CLOUDFLARE_ENV=production
PNPM_VERSION=9.15.4
CLOUDFLARE_ENV=production
PNPM_VERSION=9.15.4
While reading the docs and searching on the forum, shows that Build Cache should be supported out-of-the-box for pnpm, during my build/deployment, I see that all dependencies are always redownloaded and the cache is not properly hit. I have tried to manually create and set the .pnpm-store directory. However this is only possible in the root directory which is /opt/buildhome/repo/apps/app/.pnpm-store. Trying to set the store directory in the root of repo (/opt/buildhome/repo/.pnpm-store) results in permission denied issues. My primary concern is that during installation all dependencies are re-downloaded rather than being immediately resolved from the store. Also I receive Skipping build output cache as it's not supported for your project at the end of my project build.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?