supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.09k stars 212 forks source link

npm install error when using https-proxy #1876

Closed zxqzy closed 10 months ago

zxqzy commented 10 months ago

Describe the bug can't install supabase-cli.

To Reproduce

  1. create a new vue project
  2. run npm i supabase --save-dev

Expected behavior install supabase successfully.

Screenshots

image

Desktop (please complete the following information):

Additional context pnpm too.

image
sweatybridge commented 10 months ago

Perhaps this is a problem for newer versions of nodejs. Could you try the workaround in this comment? https://github.com/supabase/cli/issues/1769#issuecomment-1901962788

NODE_OPTIONS=--no-experimental-fetch npm i supabase --save-dev
sweatybridge commented 10 months ago

Tried on node 20 and can't reproduce.

$ docker run --rm -it node:20 npx supabase help
Need to install the following packages:
supabase@1.136.3
Ok to proceed? (y) y
Supabase CLI 1.136.3

Usage:
  supabase [command]
...
zxqzy commented 10 months ago

Perhaps this is a problem for newer versions of nodejs. Could you try the workaround in this comment? #1769 (comment)

NODE_OPTIONS=--no-experimental-fetch npm i supabase --save-dev

Is it a problem with my local environment? npm, yarn and pnpm cannot install successfully.

image image image
sweatybridge commented 10 months ago

According to the error message, there is a connection timeout downloading from github releases. Could you try downloading manually with curl and share the output?

curl -v --trace-time https://github.com/supabase/cli/releases/download/v1.136.3/supabase_darwin_amd64.tar.gz
zxqzy commented 10 months ago

According to the error message, there is a connection timeout downloading from github releases. Could you try downloading manually with curl and share the output?

curl -v --trace-time https://github.com/supabase/cli/releases/download/v1.136.3/supabase_darwin_amd64.tar.gz

my-app curl -v --trace-time https://github.com/supabase/cli/releases/download/v1.136.3/supabase_darwin_amd64.tar.gz 17:31:08.253453 Uses proxy env variable https_proxy == 'http://127.0.0.1:7890' 17:31:08.254648 Trying 127.0.0.1... 17:31:08.254672 TCP_NODELAY set 17:31:08.254821 Connected to 127.0.0.1 (127.0.0.1) port 7890 (#0) 17:31:08.254852 allocate connect buffer! 17:31:08.254873 Establish HTTP proxy tunnel to github.com:443 17:31:08.254911 > CONNECT github.com:443 HTTP/1.1 17:31:08.254911 > Host: github.com:443 17:31:08.254911 > User-Agent: curl/7.64.1 17:31:08.254911 > Proxy-Connection: Keep-Alive 17:31:08.254911 > 17:31:08.255348 < HTTP/1.1 200 Connection established 17:31:08.255377 < 17:31:08.255396 Proxy replied 200 to CONNECT request 17:31:08.255413 CONNECT phase completed! 17:31:08.255516 ALPN, offering h2 17:31:08.255542 ALPN, offering http/1.1 17:31:08.263234 successfully set certificate verify locations: 17:31:08.263262 CAfile: /etc/ssl/cert.pem CApath: none 17:31:08.263329 TLSv1.2 (OUT), TLS handshake, Client hello (1): 17:31:08.263354 CONNECT phase completed! 17:31:08.263373 CONNECT phase completed! 17:31:08.547252 TLSv1.2 (IN), TLS handshake, Server hello (2): 17:31:08.547368 TLSv1.2 (IN), TLS handshake, Certificate (11): 17:31:08.550878 TLSv1.2 (IN), TLS handshake, Server key exchange (12): 17:31:08.551778 TLSv1.2 (IN), TLS handshake, Server finished (14): 17:31:08.552320 TLSv1.2 (OUT), TLS handshake, Client key exchange (16): 17:31:08.552358 TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1): 17:31:08.552438 TLSv1.2 (OUT), TLS handshake, Finished (20): 17:31:08.657475 TLSv1.2 (IN), TLS change cipher, Change cipher spec (1): 17:31:08.657538 TLSv1.2 (IN), TLS handshake, Finished (20): 17:31:08.657563 SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256 17:31:08.657577 ALPN, server accepted to use h2 17:31:08.657593 Server certificate: 17:31:08.657618 subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=github.com 17:31:08.657638 start date: Feb 14 00:00:00 2023 GMT 17:31:08.657654 expire date: Mar 14 23:59:59 2024 GMT 17:31:08.657680 subjectAltName: host "github.com" matched cert's "github.com" 17:31:08.657701 issuer: C=US; O=DigiCert Inc; CN=DigiCert TLS Hybrid ECC SHA384 2020 CA1 17:31:08.657716 SSL certificate verify ok. 17:31:08.657746 Using HTTP2, server supports multi-use 17:31:08.657760 Connection state changed (HTTP/2 confirmed) 17:31:08.657775 Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 17:31:08.657819 Using Stream ID: 1 (easy handle 0x7fe0de00cc00) 17:31:08.657863 > GET /supabase/cli/releases/download/v1.136.3/supabase_darwin_amd64.tar.gz HTTP/2 17:31:08.657863 > Host: github.com 17:31:08.657863 > User-Agent: curl/7.64.1 17:31:08.657863 > Accept: / 17:31:08.657863 > 17:31:08.759899 Connection state changed (MAX_CONCURRENT_STREAMS == 100)! 17:31:09.101705 < HTTP/2 302 17:31:09.101783 < server: GitHub.com 17:31:09.101830 < date: Fri, 26 Jan 2024 09:31:08 GMT 17:31:09.101876 < content-type: text/html; charset=utf-8 17:31:09.101920 < vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With 17:31:09.101967 < location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/314160187/4965f0ff-2f64-4fec-a1be-432dee12d4c0?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240126%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240126T093108Z&X-Amz-Expires=300&X-Amz-Signature=34b2617d2ea0c0ddc6b9c584a373beb35f022a28580aedd8ea4b4013a0ec9c5f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=314160187&response-content-disposition=attachment%3B%20filename%3Dsupabase_darwin_amd64.tar.gz&response-content-type=application%2Foctet-stream 17:31:09.102016 < cache-control: no-cache 17:31:09.102059 < strict-transport-security: max-age=31536000; includeSubdomains; preload 17:31:09.102102 < x-frame-options: deny 17:31:09.102145 < x-content-type-options: nosniff 17:31:09.102188 < x-xss-protection: 0 17:31:09.102232 < referrer-policy: no-referrer-when-downgrade 17:31:09.102282 < content-security-policy: default-src 'none'; base-uri 'self'; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events api.githubcopilot.com objects-origin.githubusercontent.com .actions.githubusercontent.com wss://.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com .githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/ 17:31:09.102465 < content-length: 0 17:31:09.102517 < x-github-request-id: 6657:390E21:55FA1A:5C7DAB:65B37BDC 17:31:09.102563 < 17:31:09.102690 Connection #0 to host 127.0.0.1 left intact

sweatybridge commented 10 months ago

Seems like you are behind a corporate proxy which the postinstall script is not picking up. Could you try to set it explicitly like this

npm config set https-proxy http://127.0.0.1:7890
npm i supabase --save-dev
zxqzy commented 10 months ago

reproduce

image

Now, the installation was successful, but it seems that creating bin failed. What is the problem?

sweatybridge commented 10 months ago

You have to use npx supabase -v

zxqzy commented 10 months ago

You have to use npx supabase -v

Right, this is not a global installation, thanks

LucidNinja commented 6 months ago

Same issue here. Not behind a proxy though.

Screenshot 2024-05-31 at 12 59 49 PM

Are there any updates on this?