Repository navigation
fix: stop account creation hanging in local dev - #10
Merged
Merged
Conversation
… env loading) - Web dev proxy targeted "localhost", which Node resolves to ::1. When port 3001 is taken (Docker Desktop) Nuxt falls back to 3000 on ::1, so /api was proxied to Nuxt itself and every request hung. Default to 127.0.0.1. - The API never loaded .env, so `npm run dev -w @imp/api` crashed on DATABASE_URL and a stale process kept serving an old route table (404 on /api/v1/auth/*). Load .env in config/env.ts.
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
Creating an account in local dev sat on "Creating your account..." forever.
Causes (reproduced in the browser)
devProxytargetedhttp://localhost:3000. Node resolveslocalhostto::1first. Docker Desktop holds port 3001, so Nuxt falls back to port 3000 on::1and the API (IPv4) is shadowed:/api/**was proxied to Nuxt itself and never answered. Fixed by defaulting the target to127.0.0.1..env.apps/apihasdotenvbutconfig/env.tsnever called it, sonpm run dev -w @imp/apicrashed onDATABASE_URL. A stale API process (started before the identity module existed) kept serving only/healthand/users, so/api/v1/auth/*returned 404 and the form showed "Something went wrong". Fixed by loading.env(cwd and repo root) inconfig/env.ts; real environment variables still win.Verified
With both fixes, against a fresh API and a second Nuxt instance:
POST /api/v1/auth/register-participantreturned 202 and the app moved to "Check your email". Before: hang, then 404 against the stale API.Needs action on your machine
Restart
npm run dev. The running API process is stale and the running Nuxt still has the old config. Check that nothing else is bound to port 3000/3001 (netstat -ano | findstr :3001), or stop Docker's 3001 binding.Full lint/typecheck/tests run in CI.