turbo: linking remoteCache not working with Vercel

What version of Turborepo are you using?

latest

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Mac

Describe the Bug

When attempting to connect the remote cache to Vercel, I get this error:

could not get team information.
{"error":{"code":"forbidden","message":"Not authorized"}}

Expected Behavior

I am able to successfully connect to Vercel’s remove cache!

To Reproduce

  1. Install the pnpm starter
npx create-turbo@latest .
  1. Select the pnpm option for creation

  1. Log into Vercel
pnpm dlx turbo login

  1. Link the repo to Vercel
pnpm dlx turbo link

This step fails with the following error messages.

could not get team information.
{"error":{"code":"forbidden","message":"Not authorized"}}
Command failed with exit code 1: /Users/<UserName>/Library/pnpm/store/v3/tmp/dlx-3027/node_modules/.bin/turbo link

I assumed this has to do with me not having a Vercel team. I tried to set up a team and link, but I received the same error.

Thanks so much!!! I love Turborepo!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

@yowainwright Thanks for sticking with us on this one!

@d4mr that path is for macOS. On Linux it is at:

~/.config/turborepo/config.json

@yowainwright This is an extremely strange issue. Can you do me a favor and run this?

rm ~/Library/Application\ Support/turborepo/config.json
npx create-turbo@latest --use-pnpm ./my-turborepo
cd my-turborepo
npx turbo login

# Does a token show up here?
cat ~/Library/Application\ Support/turborepo/config.json

I’m wondering if we’re, for some reason, failing to write the login token to disk. Possibly file permissions, who knows.

After running this you can clear the local cache via

rm -rf node_modules/.cache/turbo and re-run pnpm run build --token=<token> --team=<team-slug> to observe cache hits. CleanShot 2022-08-08 at 18 53 58@2x

@yowainwright , I think this is something to do with turbo’s token storage in your env. Since you are able to log in. Are you able to generate a token on vercel and pass that in via:

https://turborepo.org/docs/reference/command-line-reference#--token You can generate a token via: https://vercel.com/account/tokens

for example:

npx create-turbo
// setup pnpm
// cd into turbo dir
pnpm run build --token=<token> --team=<team-slug>