Lighthouse-ci: Why does `lhci wizard` fetch /v1/projects?

Created on 12 Nov 2019  ·  4Comments  ·  Source: GoogleChrome/lighthouse-ci

$ lhci wizard
? Which wizard do you want to run? new-project
? Which server would you like to use? http://localhost:9001/
? What would you like to name the project? v8.dev
? Where is the project's code hosted? https://github.com/v8/v8.dev
FetchError: request to http://localhost:9001/v1/projects failed, reason: connect ECONNREFUSED 127.0.0.1:9001
    at ClientRequest.<anonymous> (~/.nvm/versions/node/v12.6.0/lib/node_modules/@lhci/cli/node_modules/node-fetch/index.js:133:11)
    at ClientRequest.emit (events.js:203:13)
    at Socket.socketErrorListener (_http_client.js:402:9)
    at Socket.emit (events.js:203:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

Why does it attempt to fetch /v1/projects? My web app does not do anything special for this endpoint, so the wizard exits at this point. For http://localhost:9001/v1/projects I get the above output.

If I enter https://v8.dev/ instead, it fetches https://v8.dev/v1/projects which 404s, resulting in:

$ lhci wizard
? Which wizard do you want to run? new-project
? Which server would you like to use? https://v8.dev/
? What would you like to name the project? v8.dev
? Where is the project's code hosted? https://github.com/v8/v8.dev
Error: Unexpected status code 404
    at ApiClient._convertFetchResponseToReturnValue (~/.nvm/versions/node/v12.6.0/lib/node_modules/@lhci/cli/node_modules/@lhci/utils/src/api-client.js:54:21)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
    at async runNewProjectWizard (~/.nvm/versions/node/v12.6.0/lib/node_modules/@lhci/cli/src/wizard/wizard.js:48:19)
    at async Object.runCommand (~/.nvm/versions/node/v12.6.0/lib/node_modules/@lhci/cli/src/wizard/wizard.js:75:7)
    at async run (~/.nvm/versions/node/v12.6.0/lib/node_modules/@lhci/cli/src/cli.js:82:7)

Either way the wizard exits at this point. Am I misunderstanding what I should enter?

Most helpful comment

Why does it attempt to fetch /v1/projects?

It's attempting to create a project on your LHCI server by POST'ing to /v1/projects on your LHCI server. It sounds like you don't have an LHCI server setup yet :)

You're welcome to give the canary https://lhci-canary.herokuapp.com/ URL a spin but bear in mind we're not planning on supporting this particular URL long term and older data gets cleared out periodically. A longer term solution for Chromium projects with better auth and longer history is in the works :)

AIs:

  • Update the wizard text a bit to make it clearer, "What is the URL of your LHCI server?"
  • Ping y'all when a longer-term CI server is available for chromium use, for now I'd recommend just using target=temporary-public-storage

All 4 comments

Why does it attempt to fetch /v1/projects?

It's attempting to create a project on your LHCI server by POST'ing to /v1/projects on your LHCI server. It sounds like you don't have an LHCI server setup yet :)

You're welcome to give the canary https://lhci-canary.herokuapp.com/ URL a spin but bear in mind we're not planning on supporting this particular URL long term and older data gets cleared out periodically. A longer term solution for Chromium projects with better auth and longer history is in the works :)

AIs:

  • Update the wizard text a bit to make it clearer, "What is the URL of your LHCI server?"
  • Ping y'all when a longer-term CI server is available for chromium use, for now I'd recommend just using target=temporary-public-storage

Thanks for the quick and detailed response!

My confusion mostly came from the phrasing “Which server would you like to use?” in combination with the auto-suggested input (which was http://localhost:9001/ for my project). So in addition to the AIs you outlined, perhaps the auto-suggestion could be changed in some way (or just removed)?

in combination with the auto-suggested input (which was http://localhost:9001/ for my project

Yeah agreed that might be confusing, port 9001 is the default port for LHCI server which is why it's localhost:9001 but maybe it's best to just remove this placeholder altogether since it's unlikely the majority of folks will actually host on local machines. I did want something there as an example so folks enter a valid root URL, maybe https://lhci.your-server-origin.com/?

Ah, I see. http://localhost:9001/ happens to be the URL my project uses for the local (non-LHCI) server: https://github.com/v8/v8.dev/blob/306fef6277bbf58819b8529f811fdf33298829ff/package.json#L20

I like your suggestion of using something like https://lhci.your-server-origin.com/. Maybe we could follow RFC 2606 and go with e.g. https://your-lhci-server.example.com/ or https://your-lhci-server.example/?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thomkrupa picture thomkrupa  ·  4Comments

Hongbo-Miao picture Hongbo-Miao  ·  3Comments

thasmo picture thasmo  ·  3Comments

lili21 picture lili21  ·  4Comments

mauriciabad picture mauriciabad  ·  4Comments