Skip to content

Fetch resolves before response has been received; response is undefined #13187

Closed
@andreasphil

Description

@andreasphil

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/vue

SDK Version

8.22.0

Framework Version

Vue 3.4.35

Link to Sentry event

No response

Reproduction Example/SDK Setup

Unfortunately I don't have a reproduction, but this is our setup:

(Note that I debugged useFetch and it seems to not be a useFetch issue, see Steps to Reproduce below)

Steps to Reproduce

Summary: for some long-running (a few seconds, but <10s), fetch resolves before the actual request has finished. This leads to the fetch response being undefined. Anything accessing properties of the response then crashes. Reverting to @sentry/vue v8.20.0 fixes the issue.

Example:

fetch("some-long-running-request").then((response) => {
  // Now response is sometimes undefined, so the following would lead to a TypeError:
  if (response.status === 400) {
    // ...
  }
})

Looking at the network dev tools and server logs, I can verify that the request is fulfilled successfully. However it seems that fetch resolves before the request has finished, with undefined as the value for the response.

Possibly related:

Expected Result

Fetch should not resolve before the request is finished, and response should not be undefined.

Actual Result

Fetch resolves before the request has finished, response is undefined, and accessing properties of the response causes errors.

Metadata

Metadata

Labels

Package: vueIssues related to the Sentry Vue SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions