Title: fix(logger): stop a server-side jsdom window from silencing all logging in production by waleedlatif1 · Pull Request #6339 · simstudioai/sim · GitHub
Open Graph Title: fix(logger): stop a server-side jsdom window from silencing all logging in production by waleedlatif1 · Pull Request #6339 · simstudioai/sim
X Title: fix(logger): stop a server-side jsdom window from silencing all logging in production by waleedlatif1 · Pull Request #6339 · simstudioai/sim
Description: Summary shouldLog() treated typeof window !== 'undefined' as "we are in a browser" and, in production, returned false for every level — permanently, process-wide, with no diagnostic ensureDomForTipTap() (apps/sim/lib/collab-doc/converter.ts:68) assigns globalThis.window = jsdomWindow so TipTap can run headless. The first collab-markdown request a task serves therefore kills that task's structured logging for the rest of its life jsdom is a production dependency and next.config.ts explicitly traces it into the standalone output for /api/internal/file-doc/{seed,merge,persist}, so this is live in prod. This is the only non-test window assignment in the repo Fixed by testing for a real browser instead: Node always exposes process.versions.node, a browser never does. The original intent — suppress logging in the browser in production — is preserved Evidence This is the cause of the recurring multi-hour structured-logging blackouts: Structured logs went from ~30k/30min to exactly zero while all five ECS tasks kept emitting 400–1,100 raw lines/30min — the processes were alive and console.* worked; only @sim/logger was silent Tasks went dark staggered, one at a time over ~15 minutes — the signature of a per-process latch, not a global event It self-recovered only when five brand-new task IDs appeared (a deploy). A restart cannot fix bad log data; it does clear a latched global Task a5989f51 served file-doc traffic at 15:00 and went dark at 15:08 Type of Change Bug fix Testing Two regression tests, both directions: should keep logging when the server installs a DOM — red before the fix, green after should stay silent in a real browser — passes both before and after, proving the guard's original behavior is intact and this is not simply removing it 27/27 passing. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Open Graph Description: Summary shouldLog() treated typeof window !== 'undefined' as "we are in a browser" and, in production, returned false for every level — permanently, process-wide, with no diagnos...
X Description: Summary shouldLog() treated typeof window !== 'undefined' as "we are in a browser" and, in production, returned false for every level — permanently, process-wide,...
Opengraph URL: https://github.com/simstudioai/sim/pull/6339
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:d77f3be6-2478-ee8f-cb3a-8bb82413d96d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BE94:8CC91:2E01BE:3EEFDF:6AFB52D4 |
| html-safe-nonce | 7a75e0989518a1c99462a84bd215d070714985b82aaf9c0c9572ea640a7a845b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTk0OjhDQzkxOjJFMDFCRTozRUVGREY6NkFGQjUyRDQiLCJ2aXNpdG9yX2lkIjoiNDA1Mzc5MzkyMzM2NzkxNjI0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 08f5b71f10e5c903ce5ad627a862ab875d5c737a5f04e99c112c1f4c99aa0276 |
| hovercard-subject-tag | pull_request:4223610301 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6339/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary shouldLog() treated typeof window !== 'undefined' as "we are in a browser" and, in production, returned false for every level — permanently, process-wide, with no diagnos... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cbf66c024bb6d10e6955baa7413c54cf13a201bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width