I've been monitoring the logs of the SvelteKit SSR server using adapter-node.
After customizing the server.js
to utilize Express instead of Polka, I noticed some errors occurring, particularly when the fetch()
function attempts to retrieve data from the backend API and encounters failures.
The console output received while running on docker
shows:
frontend | TypeError: fetch failed
frontend | at fetch (file:///app/build/handler.js:17895:14)
frontend | at async Object.fetch (file:///app/build/server/index.js:2273:12)
frontend | at async fetch (file:///app/build/server/index.js:991:24)
frontend | at async Promise.all (index 0)
frontend | at async load (file:///app/build/server/chunks/6-0becfa88.js:8:56)
frontend | at async load_data (file:///app/build/server/index.js:1088:16)
frontend | at async file:///app/build/server/index.js:1887:18
This stack trace lacks details about which function or source code triggered the fetch()
call. The abundance of functions named load()
in a SvelteKit project further complicates pinpointing the issue.
To enhance error readability and SvelteKit's error handling overall, it would be beneficial to display more detailed information such as the specific caller mapped to its TypeScript source file, the name of the failed page, the URL causing failure in fetch()
, and other pertinent details. This additional context could facilitate troubleshooting API call failures effectively.