Skip to content

Make dev app component URLs take explicit ports - #4754

Draft
cprecioso wants to merge 1 commit into
mainfrom
cprecioso/create-pr-v5
Draft

Make dev app component URLs take explicit ports#4754
cprecioso wants to merge 1 commit into
mainfrom
cprecioso/create-pr-v5

Conversation

@cprecioso

Copy link
Copy Markdown
Member

Description

Follow-up cleanup to the port-selection work in #4585/#4586. The dev URL helpers in Wasp.Cli.AppComponentUrls no longer bake in the default ports: makeDevUrls/makeDevClientUrl/makeDevServerUrl now take the ports as arguments, so every caller builds its URLs from the ports resolved by findAppComponentPorts. This removes makeDefaultDevRunConfigs and the record-update-the-port dance in wasp start and wasp build start, and it makes wasp db seed and wasp test resolve their ports the same way wasp start does instead of assuming 3000/3001. Marked as a code improvement since it's a refactor, but note the one behavioural consequence: with a wasp start already occupying 3000/3001, wasp db seed and wasp test will now pick the next free ports for the URLs they pass to the app (and will fail if no free port exists) rather than silently using the taken defaults.

Type of change

  • 🔧 Just code/docs improvement
  • 🐞 Bug fix
  • 🚀 New/improved feature
  • 💥 Breaking change

Checklist

  • I tested my change in a Wasp app to verify that it works as intended.

  • 🧪 Tests and apps:

    • I added unit tests for my change.
    • (if you fixed a bug) I added a regression test for the bug I fixed.
    • (if you added/updated a feature) I added/updated e2e tests in examples/kitchen-sink/e2e-tests.
    • (if you added/updated a feature) I updated the starter templates in waspc/data/Cli/templates, as needed.
    • (if you added/updated a feature) I updated the example apps in examples/, as needed.
      • (if you updated examples/tutorials) I updated the tutorial in the docs (and vice versa).
  • 📜 Documentation:

    • (if you added/updated a feature) I added/updated the documentation in web/docs/.
  • 🆕 Changelog: (if change is more than just code/docs improvement)

    • I updated waspc/ChangeLog.md with a user-friendly description of the change.
    • (if you did a breaking change) I added a step to the current migration guide in web/docs/migration-guides/.
    • I bumped the version in waspc/waspc.cabal to reflect the changes I introduced.

The dev URL helpers now take the ports they should use instead of baking in the defaults, so callers pass the ports resolved by findAppComponentPorts. This drops makeDefaultDevRunConfigs and makes wasp db seed and wasp test resolve their ports the same way wasp start does.
@cprecioso cprecioso self-assigned this Aug 21, 2026
@cprecioso
cprecioso temporarily deployed to railway-deploy-test August 21, 2026 13:42 — with GitHub Actions Inactive
@pkg-pr-new

pkg-pr-new Bot commented Aug 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wasp.sh/spec

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/spec@4754

@wasp.sh/wasp-cli

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli@4754

@wasp.sh/wasp-cli-darwin-arm64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-arm64-unknown@4754

@wasp.sh/wasp-cli-darwin-x64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-x64-unknown@4754

@wasp.sh/wasp-cli-linux-arm64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-arm64-glibc@4754

@wasp.sh/wasp-cli-linux-x64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-glibc@4754

@wasp.sh/wasp-cli-linux-x64-musl

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-musl@4754

commit: 360ed1c

@cprecioso
cprecioso marked this pull request as ready for review August 21, 2026 13:45
@cprecioso
cprecioso requested a review from a team as a code owner August 21, 2026 13:45
@cprecioso
cprecioso requested review from FranjoMindek and removed request for a team August 21, 2026 13:45

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

db seed and test client should not require free listening ports when neither command starts an app component.

Reviewed changes in the full initial diff at 360ed1c, covering the explicit-port URL refactor and all updated command paths.

  • Explicit URL ports: makeDevUrls and its component helpers now require resolved PortNumber values.
  • Start commands: wasp start and wasp build start construct run configs directly from their selected ports.
  • Non-serving commands: wasp db seed and wasp test client now probe for free ports before constructing child-process environments.
  • Run config cleanup: the default development run-config helper was removed in favor of explicit URL construction.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using GPT Sol𝕏

appSpec <- analyze waspProjectDir
let (_, serverRunConfig) = makeDefaultDevRunConfigs appSpec

ports <- findAppComponentPorts (Nothing, Nothing)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither this command nor wasp test client binds the selected ports; they only inject the resulting URLs into the child environment. When the defaults are occupied this points seed/test code at unused endpoints, and when the 50-port scan is exhausted it rejects commands that do not need a listening socket, so these non-serving paths should retain deterministic URLs or derive the actual running app URLs instead.

Technical details
# Free-port probing is invalid for non-serving commands

## Affected sites
- `waspc/cli/src/Wasp/Cli/Command/Db/Seed.hs:36-37` — probes for ports, then passes `WASP_WEB_CLIENT_URL`, `WASP_SERVER_URL`, and `PORT` to the Prisma seed process without starting either component.
- `waspc/cli/src/Wasp/Cli/Command/Test.hs:45-46` — performs the same probe before passing `REACT_APP_API_URL` and `PORT` to Vitest, again without binding either port.
- `waspc/cli/src/Wasp/Cli/Port.hs:15-21` — availability is only checked; the returned port is not reserved.

## Required outcome
- `db seed` and `test client` must not fail based on local port availability when they do not listen on those ports.
- Their injected component URLs must describe the intended endpoints rather than newly selected, unserved ports.

@cprecioso
cprecioso marked this pull request as draft August 21, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant