Production failure investigation#45
Merged
Merged
Conversation
Co-authored-by: me <me@kentcdodds.com>
|
Cursor Agent can help with this pull request. Just |
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.
Test Plan
export NODE_ENV="production" DATABASE_PATH="./prisma/sqlite.db" DATABASE_URL="file:./prisma/sqlite.db" CACHE_DATABASE_PATH="./other/cache.db" SESSION_SECRET="test-session-secret" INTERNAL_COMMAND_TOKEN="test-internal-token" HONEYPOT_SECRET="test-honeypot-secret" TWILIO_TOKEN="test-twilio-token" TWILIO_SID="test-twilio-sid" STRIPE_SECRET_KEY="test-stripe-secret" STRIPE_BASIC_PAYMENT_LINK="https://buy.stripe.com/test_basic" STRIPE_BASIC_PRODUCT="prod_test_basic" STRIPE_PREMIUM_PAYMENT_LINK="https://buy.stripe.com/test_premium" STRIPE_PREMIUM_PRODUCT="prod_test_premium" ALLOW_INDEXING="true"; node --input-type=module -e "import fs from 'fs'; const logPath = '/opt/cursor/artifacts/prod-start-test.log'; const lines = []; const log = (msg) => { lines.push(msg); console.log(msg); }; await import('./index.ts'); const delay = (ms) => new Promise((r) => setTimeout(r, ms)); await delay(2000); log('node_env ' + process.env.NODE_ENV); const res = await fetch('http://localhost:3000/'); log('status ' + res.status); await res.text(); fs.writeFileSync(logPath, lines.join('\n') + '\n'); process.exit(0);"Checklist
Screenshots
Note
Medium Risk
Changes production request routing/SSR wiring; a mismatch in the exported build module shape or middleware order could break all prod routes, but the change is small and localized.
Overview
Fixes production startup/request handling by changing the production branch in
server/index.tsto import the generated server build module andapp.use(buildModule.app).This removes the
@react-router/expresscreateRequestHandlerwiring (and its load context setup) that was incorrectly treating the server build as a React Router build, which could cause production failures.Written by Cursor Bugbot for commit b16c24a. This will update automatically on new commits. Configure here.