Own server on a Cloudflare quick tunnel: no working way to pair a phone, and the typed code says "That code expired"

Open
#78 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
ios, typescript

Research direction

Start by tracing the pairing flow from apps/link-service/install.sh and the server's POST /api/auth/pairing endpoint, then inspect how the desktop Connect from elsewhere screen and iPhone code entry handle missing public addresses. The report also flags PUT /api/mobile/presence returning 403 after pairing, so check whether that is related. Done means quick-tunnel users get a clear supported pairing path and unresolved codes no longer appear expired; confirm behavior across the desktop, server, and iPhone flows.

Written by the indexing model from the issue text.

Description

What happened

Own server installed with the --cloudflare install line from the desktop app. To pair the iPhone app, Settings > Computer > Connect from elsewhere shows only a 12-character code ("Type it on the other device. Expires in 4 min."). There is no QR code and no link.

Typing that code in the iPhone app ("Enter the code" screen) fails right away with "That code expired. Codes last five minutes. Make a new one on your computer and scan again." It happened with every fresh code. The server shows no attempt to redeem it.

As far as I can tell, the cause is that the installer gives a quick-tunnel server no public address (apps/link-service/install.sh, server_unit: "a quick tunnel's name changes on every restart, so the server names no public address for it"). Asking that server for a code directly:

POST /api/auth/pairing
-> { "url": null, "inviteUrl": null, "serverName": "...",
     "hint": "this server has no public address to put in a link: set DUSK_PUBLIC_URL, or open /pair on the address you use and type the code" }

The desktop screen doesn't show that hint, so it looks like pairing should work. On the phone side, a typed code has no way to find the server, and the app reports that as an expired code, which sends you looking in the wrong place.

What worked: set DUSK_PUBLIC_URL on duskbot.service to a stable address (a tailscale serve HTTPS address here), mint a code with POST /api/auth/pairing, turn the returned inviteUrl (duskbot://pair?address=...&token=...) into a QR code and scan it with the iPhone. That paired.

Possibly related: after pairing that way, the phone's PUT /api/mobile/presence gets 403 {"error":"only a paired phone reports where it is"}, so the server doesn't treat the session as a phone device. Push registration (deviceOf(auth)) presumably fails the same way. I can't tell whether that's because of the pairing path I used.

Suggestions:

  • On Connect from elsewhere, say when the server has no public address, and what to do about it.
  • In the phone app, show "couldn't find this server" or similar instead of "That code expired" when the code can't be resolved.
  • Give own servers on a quick tunnel a supported way to pair a phone (through the relay, or by prompting for DUSK_PUBLIC_URL).
Steps to reproduce
  1. Install on a fresh server with the desktop app's install line (... | sh, Cloudflare quick tunnel).
  2. In the desktop app with that server selected: Settings > Computer > Connect from elsewhere.
  3. Type the code shown into the iPhone app.
  4. The phone says "That code expired".
Version

desktop 0.2.18, server package 0.2.12, iOS app build 2611142024

Platform

Own server (VPS), Debian 13 amd64, paired from iPhone

Dominant language
TypeScript
Stars
277
Forks
27
Avg merge
2h 47m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DuskBotAI/duskbot

All issues in DuskBotAI/duskbot

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.