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

Supabase Link DNS resolve failure Github Actions #1967

Closed eduardosanzb closed 7 months ago

eduardosanzb commented 7 months ago

Bug report

Describe the bug

When running supabase link in CI (github action) I'm getting a DNS failuer

failed to connect to postgres: failed to connect to host=db.***.supabase.co user=postgres database=postgres: hostname resolving error

I have tried with both dns resolution strategies:

supabase link --project-ref $SUPABASE_PROJECT_ID --dns-resolver https
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    SUPABASE_INTERNAL_IMAGE_REGISTRY: ghcr.io
    SUPABASE_PROJECT_ID: ***
    SUPABASE_ACCESS_TOKEN: ***
    SUPABASE_DB_PASSWORD: ***
failed to connect to postgres: failed to connect to `host=db.***.supabase.co user=postgres database=postgres`: hostname resolving error (failed to locate valid IP for db.***.supabase.co; resolves to []utils.dnsAnswer(nil))
 supabase link --project-ref $SUPABASE_PROJECT_ID
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    SUPABASE_INTERNAL_IMAGE_REGISTRY: ghcr.io
    SUPABASE_PROJECT_ID: ***
    SUPABASE_ACCESS_TOKEN: ***
    SUPABASE_DB_PASSWORD: ***
failed to connect to postgres: failed to connect to `host=db.***.supabase.co user=postgres database=postgres`: dial error (dial tcp [2a05:d014:1c06:5f01:76ce:536:de44:42af]:5432: connect: network is unreachable)

To Reproduce

  1. Try to link a supabase in github action
  2. run action
name: Migrate Supabase DB
description: "Migrate Supabase DB"
inputs:
  supabase_access_token:
    required: true
    description: "Supabase access token"
  supabase_project_id:
    required: true
    description: "Supabase project ID"
  db_password:
    required: true
    description: "DB password"

runs:
  using: composite

  steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Setup Supabase CLI
      uses: supabase/setup-cli@v1
      with:
        version: latest

    - name: Link Supabase Project
      shell: bash
      env:
        SUPABASE_PROJECT_ID: ${{ inputs.supabase_project_id }}
        SUPABASE_ACCESS_TOKEN: ${{ inputs.supabase_access_token }}
        SUPABASE_DB_PASSWORD: ${{ inputs.db_password }}
      run: supabase link --project-ref $SUPABASE_PROJECT_ID --dns-resolver https

    - name: Migrate DB
      shell: bash
      env:
        SUPABASE_PROJECT_ID: ${{ inputs.supabase_project_id }}
        SUPABASE_ACCESS_TOKEN: ${{ inputs.supabase_access_token }}
        SUPABASE_DB_PASSWORD: ${{ inputs.db_password }}
      run: supabase db push --debug

Expected behavior

link to db

eduardosanzb commented 7 months ago

crossposting https://github.com/supabase/supabase/issues/21384

encima commented 7 months ago

This is because Github does not have full support for ipv6 (see here) We have an announcement around deprecating the support here

We have an IPv4 addon available for projects that need it to support non IPv6 services

sweatybridge commented 7 months ago

Could you share the output from supabase link --debug flag? Even with the deprecation, CLI should fallback gracefully to connection pooler which uses IPv4.

zieddhf commented 7 months ago

Hello, we got same problem, here is the supabase link --debug output :

Run supabase link --project-ref $SUPABASE_PROJECT_ID --debug
Supabase CLI 1.145.2
Pooler URL is not configured
2024/02/20 10:36:26 DNS Start: {Host:api.supabase.com}
2024/02/20 10:36:26 DNS Done: {Addrs:[{IP:104.21.30.61 Zone:} {IP:172.67.172.4[9](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:10) Zone:} {IP:2606:4700:3035::6815:1e3d Zone:} {IP:2606:4700:3035::ac43:ac31 Zone:}] Err:<nil> Coalesced:false}
2024/02/20 [10](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:11):36:26 Connect Start: tcp 104.21.30.61:443
2024/02/20 10:36:26 Connect Done: tcp 104.21.30.61:443
2024/02/20 10:36:26 TLS Start
2024/02/20 10:36:26 TLS Done: {Version:772 HandshakeComplete:true DidResume:false CipherSuite:4865 NegotiatedProtocol:h2 NegotiatedProtocolIsMutual:true ServerName:api.supabase.com PeerCertificates:[0xc00065c000 0xc00065c580 0xc00065cb00 0xc00065d080] VerifiedChains:[[0xc00065c000 0xc00065c580 0xc000870580] [0xc00065c000 0xc00065c580 0xc00065cb00 0xc000870b00]] 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](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:12) 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 [12](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:13)1 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 [13](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:14)6 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 [14](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:15)2 64 94 59 238 194 213 46 14 200 195 220 248 33 104 [15](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:16)0 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 [16](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:17)3 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 [17](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:18)9 109] TLSUnique:[] ekm:0x65b6c0}
2024/02/20 10:36:26 Sent Header: :authority [api.supabase.com]
2024/02/20 10:36:26 Sent Header: :method [GET]
2024/02/20 10:36:26 Sent Header: :path [/v1/projects/***/api-keys]
2024/02/20 10:36:26 Sent Header: :scheme [https]
2024/02/20 10:36:26 Sent Header: authorization [***
2024/02/20 10:36:26 Sent Header: user-agent [SupabaseCLI/1.145.2]
2024/02/20 10:36:26 Sent Header: accept-encoding [gzip]
2024/02/20 10:36:26 Send Done
2024/02/20 10:36:27 Recv First Byte
2024/02/20 10:36:27 Sent Header: :authority [api.supabase.com]
2024/02/20 10:36:27 Sent Header: :method [GET]
2024/02/20 10:36:27 Sent Header: :path [/v1/projects/***/config/database/pgbouncer]
2024/02/20 10:36:27 Sent Header: :scheme [https]
2024/02/20 10:36:27 Sent Header: authorization [***
2024/02/20 10:36:27 Sent Header: user-agent [SupabaseCLI/1.145.2]
2024/02/20 10:36:27 Sent Header: accept-encoding [gzip]
2024/02/20 10:36:27 Send Done
2024/02/20 10:36:27 Sent Header: :authority [api.supabase.com]
2024/02/20 10:36:27 Sent Header: :method [GET]
2024/02/20 10:36:27 Sent Header: :path [/v1/projects]
2024/02/20 10:36:27 Sent Header: :scheme [https]
2024/02/20 10:36:27 Sent Header: authorization [***
2024/02/20 10:36:27 Sent Header: user-agent [SupabaseCLI/1.145.2]
2024/02/20 10:36:27 Sent Header: accept-encoding [gzip]
2024/02/20 10:36:27 Send Done
2024/02/20 10:36:27 Sent Header: :authority [api.supabase.com]
2024/02/20 10:36:27 Sent Header: :method [GET]
2024/02/20 10:36:27 Sent Header: :path [/v1/projects/***/postgrest]
2024/02/20 10:36:27 Sent Header: :scheme [https]
2024/02/20 10:36:27 Sent Header: authorization [***
2024/02/20 10:36:27 Sent Header: user-agent [SupabaseCLI/1.145.2]
2024/02/20 10:36:27 Sent Header: accept-encoding [gzip]
2024/02/20 10:36:27 Send Done
2024/02/20 10:36:27 DNS Start: {Host:***.supabase.co}
2024/02/20 10:36:27 DNS Start: {Host:***.supabase.co}
2024/02/20 10:36:27 DNS Start: {Host:***.supabase.co}
2024/02/20 10:36:27 DNS Done: {Addrs:[{IP:172.64.149.149 Zone:} {IP:104.[18](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:19).38.107 Zone:}] Err:<nil> Coalesced:true}
2024/02/20 10:36:27 DNS Done: {Addrs:[{IP:172.64.149.149 Zone:} {IP:104.18.38.107 Zone:}] Err:<nil> Coalesced:true}
2024/02/20 10:36:27 Connect Start: tcp 172.64.149.149:443
2024/02/20 10:36:27 Connect Start: tcp 172.64.149.149:443
2024/02/20 10:36:27 DNS Done: {Addrs:[{IP:172.64.149.149 Zone:} {IP:104.18.38.107 Zone:}] Err:<nil> Coalesced:true}
2024/02/20 10:36:27 Connect Start: tcp 172.64.149.149:443
2024/02/20 10:36:27 Connect Done: tcp 172.64.149.149:443
2024/02/20 10:36:27 TLS Start
2024/02/20 10:36:27 Connect Done: tcp 172.64.149.149:443
2024/02/20 10:36:27 TLS Start
2024/02/20 10:36:27 Connect Done: tcp 172.64.149.149:443
2024/02/20 10:36:27 TLS Start
2024/02/20 10:36:27 TLS Done: {Version:772 HandshakeComplete:true DidResume:false CipherSuite:4865 NegotiatedProtocol:h2 NegotiatedProtocolIsMutual:true ServerName:***.supabase.co PeerCertificates:[0xc000871600 0xc000871b80] VerifiedChains:[[0xc000871600 0xc000871b80 0xc000872100]] SignedCertificateTimestamps:[] OCSPResponse:[48 130 1 [19](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:20) 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](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:21) 165 206 55 234 235 176 117 14 148 103 136 180 69 250 [21](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:22)7 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 [22](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:23)3 1 [23](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:24)1 129 3 65 90 [24](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:25)5 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}
2024/02/20 10:36:27 Sent Header: :authority [***.supabase.co]
2024/02/20 10:36:27 Sent Header: :method [GET]
2024/02/20 10:36:27 Sent Header: :path [/storage/v1/version]
2024/02/20 10:36:27 Sent Header: :scheme [https]
2024/02/20 10:36:27 Sent Header: apikey [***
2024/02/20 10:36:27 Sent Header: user-agent [SupabaseCLI/1.145.2]
2024/02/20 10:36:27 Sent Header: accept-encoding [gzip]
2024/02/20 10:36:27 Send Done
2024/02/20 10:36:27 Sent Header: :authority [***.supabase.co]
2024/02/20 10:36:27 Sent Header: :method [GET]
2024/02/20 10:36:27 Sent Header: :path [/rest/v1/]
2024/02/20 10:36:27 Sent Header: :scheme [https]
2024/02/20 10:36:27 Sent Header: apikey [***
2024/02/20 10:36:27 Sent Header: user-agent [SupabaseCLI/1.145.2]
2024/02/20 10:36:27 Sent Header: accept-encoding [gzip]
2024/02/20 10:36:27 Send Done
2024/02/20 10:36:27 Sent Header: :authority [***.supabase.co]
2024/02/20 10:36:27 Sent Header: :method [GET]
2024/02/20 10:36:27 Sent Header: :path [/auth/v1/health]
2024/02/20 10:36:27 Sent Header: :scheme [https]
2024/02/20 10:36:27 Sent Header: apikey [***
2024/02/20 10:36:27 Sent Header: user-agent [SupabaseCLI/1.145.2]
2024/02/20 10:36:27 Sent Header: accept-encoding [gzip]
2024/02/20 10:36:27 Send Done
2024/02/20 10:36:27 TLS Done: {Version:772 HandshakeComplete:true DidResume:false CipherSuite:4865 NegotiatedProtocol:h2 NegotiatedProtocolIsMutual:true ServerName:***.supabase.co PeerCertificates:[0xc000871600 0xc000871b80] VerifiedChains:[[0xc000871600 0xc000871b80 0xc000872100]] 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 [25](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:26)0 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}
2024/02/20 10:36:27 TLS Done: {Version:772 HandshakeComplete:true DidResume:false CipherSuite:4865 NegotiatedProtocol:h2 NegotiatedProtocolIsMutual:true ServerName:***.supabase.co PeerCertificates:[0xc000871600 0xc000871b80] VerifiedChains:[[0xc000871600 0xc000871b80 0xc000872100]] 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}
2024/02/20 10:36:27 Recv First Byte
2024/02/20 10:36:[27](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:28) Recv First Byte
2024/02/20 10:36:27 Recv First Byte
2024/02/20 10:36:27 Recv First Byte
2024/02/20 10:36:27 Recv First Byte
2024/02/20 10:36:[28](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:29) Recv First Byte
2024/02/20 10:36:28 Connect Start: udp 127.0.0.53:53
2024/02/20 10:36:28 Connect Done: udp 127.0.0.53:53
2024/02/20 10:36:28 Connect Start: udp 127.0.0.53:53
2024/02/20 10:36:28 Connect Done: udp 127.0.0.53:53
2024/02/20 10:36:28 Connect Start: udp 127.0.0.53:53
2024/02/20 10:36:28 Connect Start: udp 127.0.0.53:53
2024/02/20 10:36:28 Connect Done: udp 127.0.0.53:53
2024/02/20 10:36:28 Connect Done: udp 127.0.0.53:53
2024/02/20 10:36:28 Connect Start: tcp [2a05:d014:1c06:5f03:3888:daeb:6d77:5ba9]:54[32](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:33)
2024/02/20 10:[36](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:37):28 Connect Error: tcp [2a05:d014:1c06:5f03:[38](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:39)88:daeb:6d77:5ba9]:5[43](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:44)2 dial tcp [2a05:d014:1c06:5f03:3888:daeb:6d77:5ba9]:[54](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:55)32: connect: network is unreachable
2024/02/20 10:36:28 Connect Start: tcp [2a05:d014:1c06:5f03:3888:daeb:6d[77](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:78):5ba9]:5432
2024/02/20 10:36:28 Connect Error: tcp [2a05:d014:1c06:5f03:3[88](https://github.com/ankaboot-source/wikiadviser/actions/runs/7971796769/job/21763166250#step:4:89)8:daeb:6d77:5ba9]:5432 dial tcp [2a05:d014:1c06:5f03:3888:daeb:6d77:5ba9]:5432: connect: network is unreachable
failed to connect to postgres: failed to connect to `host=db.***.supabase.co user=postgres database=postgres`: dial error (dial tcp [2a05:d014:1c06:5f03:3888:daeb:6d77:5ba9]:5432: connect: network is unreachable)
Error: Process completed with exit code 1.
sweatybridge commented 7 months ago

Thanks, I managed to reproduce. Will release a fix soon.