ducktors / turborepo-remote-cache

Open source implementation of the Turborepo custom remote cache server.
https://ducktors.github.io/turborepo-remote-cache/
MIT License
1.03k stars 95 forks source link

`/v8/artifacts/events` returns 404 and doesn't store data locally #26

Closed StevenMatchett closed 2 years ago

StevenMatchett commented 2 years ago

When running locally I can't get my repo to actually cache the results.

Setup in turborepo-remote-cache:

yarn build
NODE_ENV=development TURBO_TOKEN=\"123\" yarn start

setup in test-turbo-reop

.turbo/config.json

{
    "teamId": "team_FcALQN9XEVbeJ1NjTQoS9Wup",
    "apiUrl": "http://localhost:3000"
}

package.json

{
    ...
    "scripts":{
            "build:turbo": "turbo run build --token=\"123\"",
            ...
    }
}

Log output from turborepo-remote-cache

{"severity":"INFO","level":30,"time":1654715502319,"pid":83236,"hostname":"MacBook-Pro-2.local","message":"Server listening at http://0.0.0.0:3000"}
^[[A{"severity":"INFO","level":30,"time":1654715546148,"pid":83236,"hostname":"MacBook-Pro-2.local","reqId":"vmy6wThJSLCcGWwTxwgjpg-0","req":{"method":"POST","url":"/v8/artifacts/events?teamId=team_FcALQN9XEVbeJ1NjTQoS9Wup","hostname":"localhost:3000","remoteAddress":"127.0.0.1","remotePort":59506},"message":"incoming request"}
{"severity":"INFO","level":30,"time":1654715546151,"pid":83236,"hostname":"MacBook-Pro-2.local","reqId":"vmy6wThJSLCcGWwTxwgjpg-0","message":"Route POST:/v8/artifacts/events?teamId=team_FcALQN9XEVbeJ1NjTQoS9Wup not found"}
{"severity":"INFO","level":30,"time":1654715546155,"pid":83236,"hostname":"MacBook-Pro-2.local","reqId":"vmy6wThJSLCcGWwTxwgjpg-0","res":{"statusCode":404},"responseTime":5.764100074768066,"message":"request completed"}
{"severity":"INFO","level":30,"time":1654715546156,"pid":83236,"hostname":"MacBook-Pro-2.local","reqId":"vmy6wThJSLCcGWwTxwgjpg-1","req":{"method":"POST","url":"/v8/artifacts/events?teamId=team_FcALQN9XEVbeJ1NjTQoS9Wup","hostname":"localhost:3000","remoteAddress":"127.0.0.1","remotePort":59508},"message":"incoming request"}
{"severity":"INFO","level":30,"time":1654715546156,"pid":83236,"hostname":"MacBook-Pro-2.local","reqId":"vmy6wThJSLCcGWwTxwgjpg-1","message":"Route POST:/v8/artifacts/events?teamId=team_FcALQN9XEVbeJ1NjTQoS9Wup not found"}
{"severity":"INFO","level":30,"time":1654715546156,"pid":83236,"hostname":"MacBook-Pro-2.local","reqId":"vmy6wThJSLCcGWwTxwgjpg-1","res":{"statusCode":404},"responseTime":0.36331605911254883,"message":"request completed"}

Is there something that I am missing with having to register a team so that it doesn't 404 with the server or a configuration step that I missed in the docs?

fox1t commented 2 years ago

Hi! Team var is needed to activate remote caching on your monorepo but it is a value that is simply ignored by turborepo-remote-cache. Teams are used only on vercel https://turborepo.org/docs/core-concepts/remote-caching#vercel I will look into this, but even if events are ignored, the caching should work anyway. The error is about this route /v8/artifacts/events that is not present in turborepo-remote-cache.

fox1t commented 2 years ago

This call was introduced here: https://github.com/vercel/turborepo/pull/754/files#diff-e8796abbdd1f61c63dc9f4a3777e05d6dd0ee9285507c033e81be6e249961d5aR197

dobesv commented 2 years ago

Might nice to support that teams endpoint but just throw away that information without an error, to avoid confusion for anyone trying to debug cache usage.

fox1t commented 2 years ago

@dobesv I agree.

fox1t commented 2 years ago

A PR to support this is welcome!