Shopify / themekit

Shopify theme development command line tool.
https://shopify.dev/tools/theme-kit
MIT License
1.2k stars 375 forks source link

"connection refused" when running theme commands #973

Closed TravisHardman closed 2 years ago

TravisHardman commented 2 years ago

I am having virtually the same bug described in this closed issue, which was closed as being a DNS issue. I don't think I have a DNS issue, though, but maybe I'm missing something...

I have an environment called "production", which in my config.yml is simply:

production:
  password: MY_PASSWORD
  theme_id: "MY_THEME_ID"
  store: MY_STORE.myshopify.com

When I run theme download -e production, I get the following error:

request failed after 5 retries with error: Get https://theme-kit-access.shopifyapps.com/cli/meta.json dial tcp: lookup theme-kit-access.shopifyapps.com on [::1]:53: read udp [::1]:51682->[::1]:53: read: connection refused

I disabled my firewall, which made no difference.

iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

I also ran the following command to see if I could connect based on the headers in the themekit source:

curl -i https://theme-kit-access.shopifyapps.com/cli/meta.json -H "X-Shopify-Access-Token: MY_PASSWORD" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Shopify-Shop: MY_STORE.myshopify.com"

That curl command worked fine, and returned a JSON object with basic information about my shop.

I'm using systemd-resolved for DNS, and resolvectl query theme-kit-access.shopifyapps.com returns the following:

theme-kit-access.shopifyapps.com: 104.16.254.71 -- link: wlan0                                                                                           
                                  104.16.255.71 -- link: wlan0

-- Information acquired via protocol DNS in 112.7ms.
-- Data is authenticated: no; Data was acquired via local or encrypted transport: no
-- Data from: cache network

My Environment:

TravisHardman commented 2 years ago

Well, in contrast to my overly confident assertion that this was not a DNS issue, it was a DNS issue. Sorry for the waste of time. I'll leave the solution here for anyone who comes across it.

Per this Stack Exchange post, there are some commands which read /etc/resolv.conf directly rather than relying on systemd-resolved or nsswitch. To test this out easily, drill is one such command.

Adding a fixed DNS server (in my case adding nameserver 1.1.1.1) to my /etc/resolv.conf allowed drill and Themekit to both resolve the DNS and connect.

fynnit commented 2 years ago

thanks travis, it helped me resolve the same issue on my end. instead of messing around with scutil or networksetup I went into System Settings → network → advanced → DNS and added 1.1.1.1 and it worked again

thanks again, I would like to know how my set up was working one day and then the other it stoppen.. but anyways, baack to work