fix(THU-537): advertise host-reachable PowerSync URL in local docker-compose#982
Open
darkbanjo wants to merge 1 commit into
Open
Conversation
- POWERSYNC_URL is echoed to the browser in the /v1/powersync/token response, so the internal `powersync:8080` Docker hostname can't resolve there and leaves the SharedWorker stuck offline - Use the host port mapping (localhost:POWERSYNC_PORT) instead
Semgrep Security ScanNo security issues found. |
|
Preview environment deployed 🚀
Stack: Auto-destroys on PR close/merge. Login via the bundled Keycloak realm — |
PR Metrics
Updated Fri, 12 Jun 2026 19:35:22 GMT · run #1881 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the local
deploy/docker-compose.ymlstack, Cloud Sync never establishes — the panel sits on "Changes will sync when back online".POWERSYNC_URLwas set to the internal Docker hostnamehttp://powersync:8080. The backend echoes that value back to the browser in/v1/powersync/token(backend/src/api/powersync.ts), and the frontend SharedWorker then tries to connect tohttp://powersync:8080/...— which only resolves inside the Docker network. Browser DNS fails silently → SharedWorker stays offline.Fix
Point
POWERSYNC_URLat the host-reachable URL via the existing port mapping:(
powersyncalready maps${POWERSYNC_PORT:-8080}:8080to the host.) Added a comment contrasting this withOIDC_DISCOVERY_URLright above it, which intentionally does use the internal hostname (backend-only, never sent to the browser).Note vs. ticket
The ticket suggested port 8081, but the actual host mapping in this file defaults to 8080 (
${POWERSYNC_PORT:-8080}:8080). Used 8080 to match the real mapping — 8081 would point at nothing.Testing
Config-only. With this change the backend advertises
http://localhost:8080, which the browser can reach, so the SharedWorker connects. (Out of scope: preview-env PowerSync architecture — separate/larger issue.)🤖 Generated with Claude Code
Note
Low Risk
Single local dev compose env change with no application code or production config impact.
Overview
Fixes local Docker Cloud Sync staying offline by changing backend
POWERSYNC_URLfrom the internal service URL (http://powersync:8080) tohttp://localhost:${POWERSYNC_PORT:-8080}, matching the published host port on thepowersyncservice.That value is returned to the browser (e.g.
/v1/powersync/token), so the client must use a host-resolvable URL—not a Docker-only hostname. A short comment was added next to the env var to contrast this withOIDC_DISCOVERY_URL, which correctly stays on an internal hostname because only the backend uses it.Reviewed by Cursor Bugbot for commit cd0615e. Bugbot is set up for automated code reviews on this repo. Configure here.