Skip to content

Errors not properly reported when streaming data fails in Sveltekit on Cloudflare #17009

@RaniSputnik

Description

@RaniSputnik

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

9.38.0

Framework Version

Sveltekit 2.17.1

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/RaniSputnik/sentry-issues/tree/streamed-data-error

I've followed the documented instructions for setting up Sveltekit and Sentry on Cloudflare. I've created a page in the app that streams data to the client. The streamed data is set up to always fail:

export const load: PageServerLoad = async () => {
    const streamedData = new Promise((resolve, reject) => 
        setTimeout(() => reject(new Error('Slow data error')), 2000))
    return { streamedData }
}

On the client, I have a page that awaits the data but doesn't catch failures:

{#await data.streamedData}
	<p>Loading...</p>
{:then streamedData}
	<p>Finished loading successfully: {JSON.stringify(streamedData)}</p>
{/await}

Steps to Reproduce

  1. Clone the linked reproduction above
  2. Deploy to Cloudflare workers
  3. Visit the /streaming-error page

Expected Result

When run locally an issue is reported from the server with details of the error:

Image

Actual Result

When run in Cloudflare there is no server-side error, just this <unknown> error from the client:

Image

I think the server error should have been reported as that would be consistent with the behavior I see locally. If I were to catch the rejected promise on the client, then the unhandled error won't be captured by Sentry at all. I don't love the <unknown> error on the client but I think that's outside the scope of this issue. I think the bigger problem here is the lack of capture on the server.

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions