I am trying to setup custom remote caching for Turborepo on vercel builds.
So far the behavior I’m seeing is that Vercel will override the TURBO_TOKEN environment variable even if we specify it outselves in the project settings.
When you say “we don’t support custom remote caching server”, I assume you mean within the Vercel build itself right? Turborepo definitely supports it - Remote Caching | Turborepo
@adirishi Caching is automatically configured for turbo repo when building to Vercel, the CI tokens are only needed for external CIs like GitHub Actions
Yup, I get that. But in case someone wanted to use a different remote cache location (e.g their own server), how can we support that in Vercel builds?
I think it seems reasonable that if the TURBO_TOKEN value is provided by the user themselves, that it shouldn’t be overriden by the build env.
@swarnava@versecafe Sorry, maybe I haven’t explained myself clearly - I already have a working remote cache server.
The issue here is that when you setup your CI pipeline in Vercel, AKA using Vercel builds and deploymnets, the build system does not respect the value of TURBO_TOKEN that I provide in project envs.
Instead, it will override that value.
The question and point of discussion here is, I consider this to be bad / buggy behavior. I believe if the value of TURBO_TOKEN is provided by the user, Vercel should avoid overriding it with their own value in builds.
We can actually see this in the build logs as well, Vercel will output
I appreciate your detailed sharing of information. It seems that Turborepo on Vercel doesn’t utilize the TURBO_TOKEN environment variable, but instead employs a different token that is configured automatically within the build pipeline. I have noticed a potential issue here, where the system is not prioritising the search for TURBO_TOKEN.
To address this, I have initiated an internal ticket. Thank you for bringing this to our attention.
Unfortunately, it’s being tracked internally and the portal isn’t available to the public. Our team has already started discussing how to handle this situation better. Thanks!
Hey @swarnava I just re-tested this. Vercel still isn’t respecting the value of the TURBO_TOKEN environment variable in builds.
It’s instead replacing it with a JWT value which I assume is supposed to be used by Vercel internally.
Hi @adirishi , can you confirm if you are using latest version of turbo to reproduce this again? FWIW, we can’t actually do anything with TURBO_TOKEN all on its own. We need one or both of TURBO_TEAM and/or TURBO_TEAMID