expose: DNS error

while running expose share

this the error i am getting Could not connect to the server. Connection to sharedwithexpose.com:443 failed during DNS lookup: DNS error

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 11
  • Comments: 42 (11 by maintainers)

Most upvoted comments

TLDR: Send a couple of sponsors my way (https://github.com/sponsors/clue) and I’m happy to solve this. 💸

This requires a feature addition in @ReactPHP which Expose builds on top of. Expose does not need any changes once this is built into @ReactPHP. :shipit:


Here’s a recap of what’s going on:

  • This only affects users that have multiple DNS servers and their primary DNS server is invalid (not reachable, not responsive etc.)
  • This happens irrespective of whether you’re using IPv4 or IPv6 (either works just fine!)
  • Having multiple DNS servers is more common in dual stack setups, hence why this seems to be linked to IPv6
  • This can be easily worked around by making sure the very first nameserver entry in your /etc/resolv.conf is valid (see above: https://github.com/beyondcode/expose/issues/25#issuecomment-683799609)
  • This can be easily reproduced by adding an invalid nameserver entry in your /etc/resolv.conf at the very top
  • An invalid nameserver entry should not cause this error when other nameserver entries are valid (this requires work, see below)

Here’s what needs to be implemented in @ReactPHP to make sure this error no longer shows up even when people have invalid nameserver entries:

  • Done: The DNS component already supports parsing multiple nameserver entries into a Config object
  • The DNS component needs to accept multiple DNS servers (limited to one address at the moment, use Config instead of a string)
  • The DNS component needs a new “DNS executor” which accepts two executors and triggers the second one only if the first one fails
  • The DNS component needs to wire up a stack of fallback executors when more than one nameserver is given in the Config
  • The DNS component needs to be tagged in order for other component to depend on this new feature
  • Done: The Socket component already parses all nameserver entries into a Config object
  • The Socket component needs to pass the complete Config object instead of only its first nameserver entry to the DNS component (requires new DNS tag)
  • The Socket component needs to be tagged in order for other component to depend on this new feature
  • The Datagram component needs to pass the complete Config object instead of only its first nameserver entry to the DNS component (requires new DNS tag)
  • The Datagram component needs to be tagged in order for other component to depend on this new feature
  • Expose needs to be updated to require the new Socket component (requires new Socket tag), the DNS implementation is entirely opaque, no other changes whatsoever are required

As you can see, this is a non-trivial amount of work. I’ve layed out this plan to show this is very much actionable and could be solved in a couple of days.

As much as I’d love to work on this, I won’t be able to commit to this right now: I’m rather busy working on a bunch of others projects at the moment.

Perhaps we can find a couple of new GitHub sponsors to allow me spending some time on this?

Put your money where your mouth is? 💸

I got the following error as others

Connection to sharedwithexpose.com:443 failed during DNS lookup:

Then looking through the above i did the following as others recommended @chiribuc thanks

edit my etc/resolv.conf and switched the IPv4 and IPv6 around.

nameserver 0000::0000:0000:0000:0000
nameserver 192.168.1.??

to

nameserver 192.168.1.??
nameserver 0000::0000:0000:0000:0000

and all run ok.

@themsaid Thanks for providing this exception trace. Can you file an issue in the upstream repo https://github.com/reactphp/dns with some details about your platform (PHP version, OS, /etc/resolv.conf and a dump of your $config object)?

We’re not currently aware of any issues in our DNS component and people have been using this on a wide variety of platforms for years, so I’m really curious what could cause this issue. The only thing I have in mind might be if your system has a broken DNS configuration (primary DNS broken, but secondary DNS works), this is not currently implemented (https://github.com/reactphp/dns/issues/6).

In the meantime, you should be able to work around this by explicitly defining another DNS server like given above. As an alternative, you can also temporarily add an entry to your /etc/hosts file like this (warning, may change in the future):

142.93.106.246 sharedwithexpose.com

Expose will also somehow use a Connector internally which accepts optional explicit DNS server configuration to override system defaults. This Connector can explicitly be configured like this:

$connector = new React\Socket\Connector($loop, array(
    'dns' => '127.0.1.1'
));