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.02k stars 201 forks source link

"SSL connection is required" error when running "npx supabase link" on Vercel #1969

Closed bizz84 closed 7 months ago

bizz84 commented 7 months ago

Describe the bug

In order to apply DB migrations, I run this custom build command on Vercel:

astro build && npx supabase link --project-ref $PUBLIC_SUPABASE_PROJECT_ID && npx supabase db push 

This was working for a long time. But since 20th Feb 2024, the Vercel build fails with:

server error (FATAL: SSL connection is required (SQLSTATE XX000))

I believe this is related to this discussion, which says:

How do I update my Vercel Supabase integration?

The environment variables POSTGRES_URL and POSTGRES_PRISMA_URL point to Supavisor and POSTGRES_URL_NON_POOLING points to Supavisor in session mode. Redeploy your Vercel application to pick up the latest environment variables. This is required since Vercel does not support IPv6.

We have also tried to create the POSTGRES_URL variable and pass the right URL there, but the problem is that supabase link doesn't use it, but it's used for migrations. But migrations can't be processed without the linked project.

Screenshots All my Vercel builds have started failing since 20th Feb 2024:

Xnapper-2024-02-20-14 55 48

System information

Vercel build log ``` [12:13:58.221] Running build in Washington, D.C., USA (East) – iad1 [12:13:58.344] Cloning (Branch: dev, Commit: 272620c) [12:13:58.359] Skipping build cache, deployment was triggered without cache. [12:13:59.625] Cloning completed: 1.281s [12:14:00.016] Running "vercel build" [12:14:00.501] Vercel CLI 33.5.1 [12:14:01.213] Installing dependencies... [12:14:01.512] yarn install v1.22.17 [12:14:01.581] [1/4] Resolving packages... [12:14:01.719] warning Resolution field "@supabase/gotrue-js@2.38.0" is incompatible with requested version "@supabase/gotrue-js@^2.56.0" [12:14:01.867] [2/4] Fetching packages... [12:14:16.563] warning prettier-plugin-astro@0.8.1: The engine "pnpm" appears to be invalid. [12:14:16.564] [3/4] Linking dependencies... [12:14:16.567] warning " > @vitejs/plugin-basic-ssl@1.0.2" has unmet peer dependency "vite@^3.0.0 || ^4.0.0 || ^5.0.0". [12:14:16.581] warning Workspaces can only be enabled in private projects. [12:14:21.453] [4/4] Building fresh packages... [12:14:22.565] $ cd 'cli' && yarn [12:14:22.859] yarn install v1.22.17 [12:14:22.905] [1/4] Resolving packages... [12:14:22.958] warning Resolution field "@supabase/gotrue-js@2.38.0" is incompatible with requested version "@supabase/gotrue-js@^2.60.0" [12:14:22.961] [2/4] Fetching packages... [12:14:25.211] [3/4] Linking dependencies... [12:14:26.143] [4/4] Building fresh packages... [12:14:26.151] Done in 3.30s. [12:14:26.174] $ husky install [12:14:26.249] husky - Git hooks installed [12:14:26.253] Done in 24.75s. [12:14:28.282] npm WARN exec The following package was not found and will be installed: supabase@1.145.4 [12:14:30.052] Supabase CLI 1.145.4 [12:14:30.053] 2024/02/20 12:14:30 DNS Start: {Host:api.supabase.com} [12:14:30.055] 2024/02/20 12:14:30 DNS Done: {Addrs:[{IP:104.21.30.61 Zone:} {IP:172.67.172.49 Zone:} {IP:2606:4700:3035::ac43:ac31 Zone:} {IP:2606:4700:3035::6815:1e3d Zone:}] Err: Coalesced:false} [12:14:30.055] 2024/02/20 12:14:30 Connect Start: tcp 104.21.30.61:443 [12:14:30.056] 2024/02/20 12:14:30 Connect Done: tcp 104.21.30.61:443 [12:14:30.056] 2024/02/20 12:14:30 TLS Start [12:14:30.104] 2024/02/20 12:14:30 TLS Done: {Version:772 HandshakeComplete:true DidResume:false CipherSuite:4865 NegotiatedProtocol:h2 NegotiatedProtocolIsMutual:true ServerName:api.supabase.com PeerCertificates:[0xc000166000 0xc000166580 0xc000166b00 0xc000167080] VerifiedChains:[[0xc000166000 0xc000166580 0xc000168c00] [0xc000166000 0xc000166580 0xc000166b00 0xc000169180]] SignedCertificateTimestamps:[] OCSPResponse:[48 130 1 84 10 1 0 160 130 1 77 48 130 1 73 6 9 43 6 1 5 5 7 48 1 1 4 130 1 58 48 130 1 54 48 129 190 161 52 48 50 49 11 48 9 6 3 85 4 6 19 2 85 83 49 22 48 20 6 3 85 4 10 19 13 76 101 116 39 115 32 69 110 99 114 121 112 116 49 11 48 9 6 3 85 4 3 19 2 69 49 24 15 50 48 50 52 48 50 49 56 48 49 53 48 48 48 90 48 117 48 115 48 75 48 9 6 5 43 14 3 2 26 5 0 4 20 239 144 1 112 221 88 143 42 101 30 33 81 31 220 208 187 111 81 43 171 4 20 90 243 237 43 252 54 194 55 121 185 82 48 234 84 111 207 85 203 46 172 2 18 4 52 217 5 193 95 6 36 206 83 231 214 129 48 136 97 98 51 128 0 24 15 50 48 50 52 48 50 49 56 48 49 53 48 48 48 90 160 17 24 15 50 48 50 52 48 50 50 53 48 49 52 57 53 56 90 48 10 6 8 42 134 72 206 61 4 3 3 3 103 0 48 100 2 48 5 154 142 64 94 59 238 194 213 46 14 200 195 220 248 33 104 150 119 200 191 41 223 22 178 129 217 33 217 190 7 56 60 102 171 63 203 148 172 199 38 55 249 103 34 219 223 6 2 48 105 179 248 209 170 123 163 52 119 208 146 74 39 221 184 180 138 160 6 190 208 246 29 154 133 29 12 202 132 62 246 144 13 112 211 33 19 65 239 50 169 41 158 76 249 231 179 109] TLSUnique:[] ekm:0x65b6c0} [12:14:30.104] 2024/02/20 12:14:30 Sent Header: :authority [api.supabase.com] [12:14:30.104] 2024/02/20 12:14:30 Sent Header: :method [GET] [12:14:30.104] 2024/02/20 12:14:30 Sent Header: :path [/v1/projects//api-keys] [12:14:30.105] 2024/02/20 12:14:30 Sent Header: :scheme [https] [12:14:30.105] 2024/02/20 12:14:30 Sent Header: authorization [Bearer ] [12:14:30.105] 2024/02/20 12:14:30 Sent Header: user-agent [SupabaseCLI/1.145.4] [12:14:30.105] 2024/02/20 12:14:30 Sent Header: accept-encoding [gzip] [12:14:30.105] 2024/02/20 12:14:30 Send Done [12:14:30.317] 2024/02/20 12:14:30 Recv First Byte [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :authority [api.supabase.com] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :method [GET] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :path [/v1/projects//config/database/pgbouncer] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :scheme [https] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: authorization [Bearer ] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: user-agent [SupabaseCLI/1.145.4] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: accept-encoding [gzip] [12:14:30.318] 2024/02/20 12:14:30 Send Done [12:14:30.318] 2024/02/20 12:14:30 DNS Start: {Host:.supabase.co} [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :authority [api.supabase.com] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :method [GET] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :path [/v1/projects//postgrest] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :scheme [https] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: authorization [Bearer ] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: user-agent [SupabaseCLI/1.145.4] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: accept-encoding [gzip] [12:14:30.318] 2024/02/20 12:14:30 Send Done [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :authority [api.supabase.com] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :method [GET] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :path [/v1/projects] [12:14:30.318] 2024/02/20 12:14:30 Sent Header: :scheme [https] [12:14:30.319] 2024/02/20 12:14:30 Sent Header: authorization [Bearer ] [12:14:30.319] 2024/02/20 12:14:30 Sent Header: user-agent [SupabaseCLI/1.145.4] [12:14:30.319] 2024/02/20 12:14:30 Sent Header: accept-encoding [gzip] [12:14:30.319] 2024/02/20 12:14:30 Send Done [12:14:30.319] 2024/02/20 12:14:30 DNS Start: {Host:.supabase.co} [12:14:30.319] 2024/02/20 12:14:30 DNS Start: {Host:.supabase.co} [12:14:30.322] 2024/02/20 12:14:30 DNS Done: {Addrs:[{IP:104.18.38.107 Zone:} {IP:172.64.149.149 Zone:}] Err: Coalesced:true} [12:14:30.322] 2024/02/20 12:14:30 Connect Start: tcp 104.18.38.107:443 [12:14:30.322] 2024/02/20 12:14:30 DNS Done: {Addrs:[{IP:104.18.38.107 Zone:} {IP:172.64.149.149 Zone:}] Err: Coalesced:true} [12:14:30.322] 2024/02/20 12:14:30 Connect Start: tcp 104.18.38.107:443 [12:14:30.322] 2024/02/20 12:14:30 DNS Done: {Addrs:[{IP:104.18.38.107 Zone:} {IP:172.64.149.149 Zone:}] Err: Coalesced:true} [12:14:30.323] 2024/02/20 12:14:30 Connect Start: tcp 104.18.38.107:443 [12:14:30.323] 2024/02/20 12:14:30 Connect Done: tcp 104.18.38.107:443 [12:14:30.323] 2024/02/20 12:14:30 TLS Start [12:14:30.323] 2024/02/20 12:14:30 Connect Done: tcp 104.18.38.107:443 [12:14:30.324] 2024/02/20 12:14:30 TLS Start [12:14:30.324] 2024/02/20 12:14:30 Connect Done: tcp 104.18.38.107:443 [12:14:30.324] 2024/02/20 12:14:30 TLS Start [12:14:30.330] 2024/02/20 12:14:30 TLS Done: {Version:772 HandshakeComplete:true DidResume:false CipherSuite:4865 NegotiatedProtocol:h2 NegotiatedProtocolIsMutual:true ServerName:.supabase.co PeerCertificates:[0xc000580580 0xc000580b00] VerifiedChains:[[0xc000580580 0xc000580b00 0xc000581080]] SignedCertificateTimestamps:[] OCSPResponse:[48 130 1 19 10 1 0 160 130 1 12 48 130 1 8 6 9 43 6 1 5 5 7 48 1 1 4 129 250 48 129 247 48 129 158 162 22 4 20 165 206 55 234 235 176 117 14 148 103 136 180 69 250 217 36 16 135 150 31 24 15 50 48 50 52 48 50 49 57 50 48 52 56 53 57 90 48 115 48 113 48 73 48 9 6 5 43 14 3 2 26 5 0 4 20 18 215 139 64 44 53 98 6 250 130 127 142 216 146 36 17 180 172 245 4 4 20 165 206 55 234 235 176 117 14 148 103 136 180 69 250 217 36 16 135 150 31 2 16 9 169 150 86 201 79 120 63 128 232 115 212 115 59 141 68 128 0 24 15 50 48 50 52 48 50 49 57 50 48 51 51 48 49 90 160 17 24 15 50 48 50 52 48 50 50 54 49 57 51 51 48 49 90 48 10 6 8 42 134 72 206 61 4 3 2 3 72 0 48 69 2 32 21 249 25 57 148 88 3 223 1 231 129 3 65 90 245 205 148 33 175 201 41 140 7 75 51 29 26 113 191 8 219 94 2 33 0 155 156 141 228 34 5 82 177 138 163 195 60 140 103 215 186 139 212 202 170 233 30 179 174 13 201 51 229 169 179 185 13] TLSUnique:[] ekm:0x65b6c0} [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :authority [.supabase.co] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :method [GET] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :path [/rest/v1/] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :scheme [https] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: apikey [] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: user-agent [SupabaseCLI/1.145.4] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: accept-encoding [gzip] [12:14:30.330] 2024/02/20 12:14:30 Send Done [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :authority [.supabase.co] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :method [GET] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :path [/auth/v1/health] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :scheme [https] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: apikey [] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: user-agent [SupabaseCLI/1.145.4] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: accept-encoding [gzip] [12:14:30.330] 2024/02/20 12:14:30 Send Done [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :authority [.supabase.co] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :method [GET] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :path [/storage/v1/version] [12:14:30.330] 2024/02/20 12:14:30 Sent Header: :scheme [https] [12:14:30.331] 2024/02/20 12:14:30 Sent Header: apikey [] [12:14:30.331] 2024/02/20 12:14:30 Sent Header: user-agent [SupabaseCLI/1.145.4] [12:14:30.331] 2024/02/20 12:14:30 Sent Header: accept-encoding [gzip] [12:14:30.331] 2024/02/20 12:14:30 Send Done [12:14:30.331] 2024/02/20 12:14:30 TLS Done: {Version:772 HandshakeComplete:true DidResume:false CipherSuite:4865 NegotiatedProtocol:h2 NegotiatedProtocolIsMutual:true ServerName:.supabase.co PeerCertificates:[0xc000580580 0xc000580b00] VerifiedChains:[[0xc000580580 0xc000580b00 0xc000581080]] SignedCertificateTimestamps:[] OCSPResponse:[48 130 1 19 10 1 0 160 130 1 12 48 130 1 8 6 9 43 6 1 5 5 7 48 1 1 4 129 250 48 129 247 48 129 158 162 22 4 20 165 206 55 234 235 176 117 14 148 103 136 180 69 250 217 36 16 135 150 31 24 15 50 48 50 52 48 50 49 57 50 48 52 56 53 57 90 48 115 48 113 48 73 48 9 6 5 43 14 3 2 26 5 0 4 20 18 215 139 64 44 53 98 6 250 130 127 142 216 146 36 17 180 172 245 4 4 20 165 206 55 234 235 176 117 14 148 103 136 180 69 250 217 36 16 135 150 31 2 16 9 169 150 86 201 79 120 63 128 232 115 212 115 59 141 68 128 0 24 15 50 48 50 52 48 50 49 57 50 48 51 51 48 49 90 160 17 24 15 50 48 50 52 48 50 50 54 49 57 51 51 48 49 90 48 10 6 8 42 134 72 206 61 4 3 2 3 72 0 48 69 2 32 21 249 25 57 148 88 3 223 1 231 129 3 65 90 245 205 148 33 175 201 41 140 7 75 51 29 26 113 191 8 219 94 2 33 0 155 156 141 228 34 5 82 177 138 163 195 60 140 103 215 186 139 212 202 170 233 30 179 174 13 201 51 229 169 179 185 13] TLSUnique:[] ekm:0x65b6c0} [12:14:30.331] 2024/02/20 12:14:30 TLS Done: {Version:772 HandshakeComplete:true DidResume:false CipherSuite:4865 NegotiatedProtocol:h2 NegotiatedProtocolIsMutual:true ServerName:.supabase.co PeerCertificates:[0xc000580580 0xc000580b00] VerifiedChains:[[0xc000580580 0xc000580b00 0xc000581080]] SignedCertificateTimestamps:[] OCSPResponse:[48 130 1 19 10 1 0 160 130 1 12 48 130 1 8 6 9 43 6 1 5 5 7 48 1 1 4 129 250 48 129 247 48 129 158 162 22 4 20 165 206 55 234 235 176 117 14 148 103 136 180 69 250 217 36 16 135 150 31 24 15 50 48 50 52 48 50 49 57 50 48 52 56 53 57 90 48 115 48 113 48 73 48 9 6 5 43 14 3 2 26 5 0 4 20 18 215 139 64 44 53 98 6 250 130 127 142 216 146 36 17 180 172 245 4 4 20 165 206 55 234 235 176 117 14 148 103 136 180 69 250 217 36 16 135 150 31 2 16 9 169 150 86 201 79 120 63 128 232 115 212 115 59 141 68 128 0 24 15 50 48 50 52 48 50 49 57 50 48 51 51 48 49 90 160 17 24 15 50 48 50 52 48 50 50 54 49 57 51 51 48 49 90 48 10 6 8 42 134 72 206 61 4 3 2 3 72 0 48 69 2 32 21 249 25 57 148 88 3 223 1 231 129 3 65 90 245 205 148 33 175 201 41 140 7 75 51 29 26 113 191 8 219 94 2 33 0 155 156 141 228 34 5 82 177 138 163 195 60 140 103 215 186 139 212 202 170 233 30 179 174 13 201 51 229 169 179 185 13] TLSUnique:[] ekm:0x65b6c0} [12:14:30.443] 2024/02/20 12:14:30 Recv First Byte [12:14:30.478] 2024/02/20 12:14:30 Recv First Byte [12:14:30.700] 2024/02/20 12:14:30 Recv First Byte [12:14:30.702] 2024/02/20 12:14:30 Recv First Byte [12:14:30.844] 2024/02/20 12:14:30 Recv First Byte [12:14:31.188] 2024/02/20 12:14:31 Recv First Byte [12:14:31.189] Using connection pooler: postgres://postgres.:@aws-0-eu-central-1.pooler.supabase.com:6543/postgres [12:14:31.190] 2024/02/20 12:14:31 Connect Start: udp 172.31.0.2:53 [12:14:31.190] 2024/02/20 12:14:31 Connect Start: udp 172.31.0.2:53 [12:14:31.190] 2024/02/20 12:14:31 Connect Done: udp 172.31.0.2:53 [12:14:31.190] 2024/02/20 12:14:31 Connect Done: udp 172.31.0.2:53 [12:14:31.193] 2024/02/20 12:14:31 Connect Start: udp 172.31.0.2:53 [12:14:31.193] 2024/02/20 12:14:31 Connect Done: udp 172.31.0.2:53 [12:14:31.193] 2024/02/20 12:14:31 Connect Start: udp 172.31.0.2:53 [12:14:31.193] 2024/02/20 12:14:31 Connect Done: udp 172.31.0.2:53 [12:14:31.193] 2024/02/20 12:14:31 Connect Start: tcp 18.198.30.239:6543 [12:14:31.285] 2024/02/20 12:14:31 Connect Done: tcp 18.198.30.239:6543 [12:14:31.285] 2024/02/20 12:14:31 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres."}} [12:14:31.376] 2024/02/20 12:14:31 PG Recv: {"Type":"ErrorResponse","Severity":"FATAL","SeverityUnlocalized":"FATAL","Code":"XX000","Message":"SSL connection is required","Detail":"","Hint":"","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"","Line":0,"Routine":"","UnknownFields":null} [12:14:31.376] 2024/02/20 12:14:31 Connect Start: tcp 18.198.145.223:6543 [12:14:31.468] 2024/02/20 12:14:31 Connect Done: tcp 18.198.145.223:6543 [12:14:31.471] 2024/02/20 12:14:31 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres."}} [12:14:31.562] 2024/02/20 12:14:31 PG Recv: {"Type":"ErrorResponse","Severity":"FATAL","SeverityUnlocalized":"FATAL","Code":"XX000","Message":"SSL connection is required","Detail":"","Hint":"","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"","Line":0,"Routine":"","UnknownFields":null} [12:14:31.562] 2024/02/20 12:14:31 Connect Start: tcp 18.198.145.223:6543 [12:14:31.654] 2024/02/20 12:14:31 Connect Done: tcp 18.198.145.223:6543 [12:14:31.655] 2024/02/20 12:14:31 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres."}} [12:14:31.746] 2024/02/20 12:14:31 PG Recv: {"Type":"ErrorResponse","Severity":"FATAL","SeverityUnlocalized":"FATAL","Code":"XX000","Message":"SSL connection is required","Detail":"","Hint":"","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"","Line":0,"Routine":"","UnknownFields":null} [12:14:31.746] 2024/02/20 12:14:31 Connect Start: tcp 18.198.30.239:6543 [12:14:31.837] 2024/02/20 12:14:31 Connect Done: tcp 18.198.30.239:6543 [12:14:31.837] 2024/02/20 12:14:31 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres."}} [12:14:31.927] 2024/02/20 12:14:31 PG Recv: {"Type":"ErrorResponse","Severity":"FATAL","SeverityUnlocalized":"FATAL","Code":"XX000","Message":"SSL connection is required","Detail":"","Hint":"","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"","Line":0,"Routine":"","UnknownFields":null} [12:14:31.928] failed to connect to postgres: failed to connect to `host=aws-0-eu-central-1.pooler.supabase.com user=postgres. database=postgres`: server error (FATAL: SSL connection is required (SQLSTATE XX000)) [12:14:31.945] Error: Command "npx supabase link --project-ref $PUBLIC_SUPABASE_PROJECT_ID --debug" exited with 1 [12:14:32.446] ```

Additional context

I see this in the log:

My package.json:

"dependencies": {
  "@supabase/supabase-js": "^2.33.2"
},
"resolutions": {
  "@supabase/supabase-js": "2.24.0",
  "@supabase/gotrue-js": "2.38.0"
}

How should we configure Vercel so that npx supabase link starts working again in light of the changes introduced here?

https://github.com/orgs/supabase/discussions/17817

sweatybridge commented 7 months ago

Could you try running npx supabase link without debug flag? SSL cannot be enabled in debug mode at the moment.

webdevleo commented 7 months ago

Could you try running npx supabase link without debug flag? SSL cannot be enabled in debug mode at the moment.

Thanks for you answer. It solved the issue

peterkos commented 1 month ago

For anyone else coming to here from a search, updating to the latest supabase CLI 1.187.8 fixed the issue for myself on a similar error w/ brew :)

Also noted here: https://github.com/orgs/supabase/discussions/21058

aradhya-variational-io commented 1 month ago

seeing the same issue, updating supabase CLI didnt help

wemgl commented 1 month ago

I'm on supabase CLI version 1.187.10 (the latest version at the time of this comment) and I'm still having this issue. Here's a portion of the logs I see when I run supabase db pull --debug in my terminal:

2024/08/06 08:06:41 Connect Start: tcp [REDACTED]:5432
2024/08/06 08:06:41 Connect Done: tcp [REDACTED]:5432
2024/08/06 08:06:41 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres.[REDACTED]"}}
2024/08/06 08:06:41 PG Recv: {"Type":"ErrorResponse","Severity":"FATAL","SeverityUnlocalized":"FATAL","Code":"XX000","Message":"SSL connection is required","Detail":"","Hint":"","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"","Line":0,"Routine":"","UnknownFields":null}
failed to connect to postgres: failed to connect to `host=aws-0-us-east-1.pooler.supabase.com user=postgres.[REDACTED] database=postgres`: server error (FATAL: SSL connection is required (SQLSTATE XX000))

What's interesting is that I see this when I run the aforementioned comment without the debug flag:

failed to connect to postgres: failed to connect to `host=127.0.0.1 user=postgres database=postgres`: dial error (dial tcp 127.0.0.1:54320: connect: connection refused)

Note that the log line mentions the database running on my local machine and not the pooler.supabase.com one. Any ideas? I also realized that I have SSL Enforcement enabled on the database for my project, but I'd rather not disable it at the moment.

sweatybridge commented 1 month ago

dial error (dial tcp 127.0.0.1:54320: connect: connection refused)

This is indicative of an error connecting to shadow database. Do you have docker host networking enabled in settings?

The --debug flag is not compatible with ssl so the other error is not really actionable.

wemgl commented 1 month ago

@sweatybridge I was actually using colima and I think that contributed to the error I was having. I stopped it, switched over to using the macOS Docker app, and then ran the supabase db pull command again and it finally worked.