Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing with a lhci server behind proxy (create new projet) #574

Closed
rdelgatte opened this issue Mar 16, 2021 · 2 comments · Fixed by #727
Closed

Dealing with a lhci server behind proxy (create new projet) #574

rdelgatte opened this issue Mar 16, 2021 · 2 comments · Fixed by #727
Labels
enhancement New feature or request help wanted Extra attention is needed P2

Comments

@rdelgatte
Copy link

I've just set up a lhci-server following the documentation and I am trying to create a new project using lhci wizard locally.

The server is both reachable in my browser and a curl (after setting up my proxy: HTTPS_PROXY env variable) but I've got a TIMEOUT when trying to create a new project.

➜  curl https://my-lhci-server/version
0.7.0%       

But when I go through the lhci wizard:

➜  lhci wizard
? Which wizard do you want to run? new-project
? What is the URL of your LHCI server? https://my-lhci-server
? What would you like to name the project? my-project
? Where is the project's code hosted? https://github.com/whatever
? What branch is considered the repo's trunk or main branch? master
FetchError: request to https://my-lhci-server/v1/projects failed, reason: connect ETIMEDOUT 35.204.214.248:443
    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/@lhci/cli/node_modules/node-fetch/lib/index.js:1461:11)
    at ClientRequest.emit (node:events:376:20)
    at TLSSocket.socketErrorListener (node:_http_client:486:9)
    at TLSSocket.emit (node:events:376:20)
    at emitErrorNT (node:internal/streams/destroy:188:8)
    at emitErrorCloseNT (node:internal/streams/destroy:153:3)
    at processTicksAndRejections (node:internal/process/task_queues:80:21)%       

If I try to curl over the projects HTTP endpoint, it works:

➜  curl https://my-lhci-server/v1/projects
[]%  

I guess it is related to the proxy configuration which isn't used by lhci when creating the project (but also when running) so I may be blocked because of it.
Is there any way to provide a proxy url to lhci so it go through it to do any request?

Thank you in advance for your help!

@patrickhulce
Copy link
Collaborator

Thanks for filing @rdelgatte! Proxy support is not great in node and most node http libraries. We would need to thread this through ourselves (see node-fetch/node-fetch#195) to support this.

As a workaround you'd need to run lhci wizard on the server itself (or somewhere you don't need proxy connections) or painfully reproduce the API calls via CURL/Postman.

@patrickhulce patrickhulce added enhancement New feature or request P2 help wanted Extra attention is needed labels Apr 12, 2021
@AndreasWurm
Copy link

I replaced the dependency on isomorphic-fetch with https://www.npmjs.com/package/node-fetch-with-proxy to get proxy support for the cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed P2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@AndreasWurm @patrickhulce @rdelgatte and others