Fix Netlify edge function crash and remove importRuntimeWithoutVite workaround#548
Merged
anthonybailey merged 2 commits intomainfrom Nov 15, 2025
Merged
Fix Netlify edge function crash and remove importRuntimeWithoutVite workaround#548anthonybailey merged 2 commits intomainfrom
anthonybailey merged 2 commits intomainfrom
Conversation
Implements window deletion approach to fix paraglide crash on cold edge function starts. Netlify's Deno 2.3.1 provides partial window object (window exists but window.location undefined) which breaks paraglide-js. Changes: - Add window deletion in hooks.server.ts before paraglide imports - Remove custom isServer override (use paraglide default) - Clarify disableAsyncLocalStorage comment for serverless context The fix detects Netlify's Deno environment and removes the incomplete window stub, making it behave like standard Deno/Node.js where window is properly undefined during SSR. See: notes/20251113-paraglide-edge-function-investigation.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
With paraglide's default isServer check, we no longer need the importRuntimeWithoutVite() workaround that patched 'import.meta.env.SSR'. Changes: - Remove importRuntimeWithoutVite() function from utils.ts - Use static imports in vite.config.ts, l10ntamer.ts, and check-setup-needed.js - Keep dynamic await import() only in run.ts (bootstraps runtime.js) - Update test mocks to mock runtime module directly All scripts can use static imports since runtime.js is generated before checks run (via pnpm inlang:settings in CI). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for pauseai ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Wituareard
approved these changes
Nov 15, 2025
Collaborator
Wituareard
left a comment
There was a problem hiding this comment.
Good work, I completely forgot about the importRuntimeWithoutVite hack
anthonybailey
pushed a commit
that referenced
this pull request
Nov 15, 2025
Re-add People page with AirTable integration Restores the People of PauseAI page, now pulling data from AirTable Members table to showcase staff and key contributors. The page encountered edge function issues with HTTP 500 errors on cold starts due to Netlify's Deno runtime providing a partial window object that broke paraglide-js. This was investigated in #544 and fixed in #548 with a runtime workaround that deletes the incomplete window stub. The fix has been verified working with this page deployment. Note: This page dynamically queries AirTable on each request. It should probably be prerendered (static) in the future to avoid unnecessary load on AirTable, as our key staff don't change frequently. However, it served as a valuable test case for edge function fixes, so merging as-is for now. Original work by @Pato-desu Fixes: #538, #540 Related: #544, #548
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.

Summary
Fixes the paraglide window.location crash on cold Netlify edge function starts and removes the now-unnecessary
importRuntimeWithoutVite()workaround.(Apologies for the branch name pun - couldn't resist "deno-uncement" for removing cemented workarounds from our Deno edge code!)
Problem
Netlify's Deno 2.3.1 edge runtime provides a partial
windowstub wherewindowexists butwindow.locationis undefined. This breaks paraglide-js which assumeswindow.locationexists ifwindowexists, causing HTTP 500 errors on first request to dynamic pages.Solution
hooks.server.tsbefore paraglide loads, making Netlify's Deno behave like standard Deno/Node.jsimportRuntimeWithoutVite()function and use simple static imports now that we use paraglide's defaultisServercheckChanges
src/hooks.server.ts(detects Netlify Deno environment)isServeroverride inscripts/inlang-settings.ts(use paraglide default)importRuntimeWithoutVite()workaround functionTesting
pnpm dev,netlify serve/peoplerequest: HTTP 200 (was HTTP 500)Related Issues
Fixes: #538, #540
See: notes/20251113-paraglide-edge-function-investigation.md
🤖 Generated with Claude Code