fix: resolve GraphQL request hang in Fastify integration
All checks were successful
Build and Push Backend Image / build (push) Successful in 39s
Build and Push Frontend Image / build (push) Successful in 4m7s

- Pass FastifyRequest/FastifyReply directly to yoga.handleNodeRequestAndResponse
  per the official graphql-yoga Fastify integration docs. Yoga v5 uses req.body
  (already parsed by Fastify) when available, avoiding the dead raw stream issue.
- Add proper TypeScript generics for server context including db and redis
- Wrap sendVerification/sendPasswordReset in try/catch so missing SMTP
  does not crash register/requestPasswordReset mutations
- Fix migrate.ts path resolution to work with both tsx (src/) and compiled (dist/)
- Expose postgres:5432 and redis:6379 ports in compose.yml for local dev

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 20:31:18 +01:00
parent 012bb176d9
commit 1e930baccb
5 changed files with 36 additions and 23 deletions

View File

@@ -11,7 +11,11 @@ const db = drizzle(pool);
async function main() {
console.log("Running schema migrations...");
const migrationsFolder = path.join(__dirname, "../../migrations");
// In dev (tsx): __dirname = src/scripts → migrations are at src/migrations
// In prod (node dist): __dirname = dist/scripts → migrations are at ../../migrations (package root)
const migrationsFolder = __dirname.includes("/src/")
? path.join(__dirname, "../migrations")
: path.join(__dirname, "../../migrations");
await migrate(db, { migrationsFolder });
console.log("Schema migrations complete.");
await pool.end();