Description
Reproduction
Make a vanilla Remix application using the Cloudflare Pages template. Create a getLoadContext handler with nothing but a thrown exception in its body.
The exception will be handled and trigger a 500 exception. Since it's technically handled, the unhandled exception doesn't reach Cloudflare's logs (you get a 500 error in the log with the exceptions and log fields empty).
For exceptions outside of the getLoadContext, you get the same behavior, but the handleError function in the entry.server.tsx lets you handle these globally.
For getLoadContext, it seems the only way is to wrap it in a try/catch and log them ourselves, which is unexpected.
System Info
Cloudflare Pages
Default Cloudflare Pages template.
System spec (not really relevant here though)
System:
OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
Memory: 27.30 GB / 31.20 GB
Container: Yes
Shell: 3.7.0 - /usr/bin/fish
Binaries:
Node: 20.10.0 - /mnt/wslg/runtime-dir/fnm_multishells/66_1726539442834/bin/node
npm: 10.2.3 - /mnt/wslg/runtime-dir/fnm_multishells/66_1726539442834/bin/npm
pnpm: 9.7.1 - /mnt/wslg/runtime-dir/fnm_multishells/66_1726539442834/bin/pnpm
Browsers:
Chrome: 122.0.6261.57
Used Package Manager
pnpm
Expected Behavior
One of the following:
- the handleError function of entry.server.tsx allows handling of exceptions in getLoadContext
- Exceptions in getLoadContext bubbles all the way up, allowing them to be seen in Cloudflare logs
- Having an additional property to getLoadContext or createPagesFunctionHandler/cloudflareDevProxyVitePlugin with a "truly global" error handler, so we can easily ensure no exceptions bubble up and gets swallowed.
- If none of the above are possible, clearly documenting the behavior and what a developer should do to avoid cloudflare server errors without exception logs.
Actual Behavior
The page load with a "server error" message, a 500 entry in the Cloudflare logs, and no additional logs/exceptions.