Skip to content

Aborted fetches have unsuable stack traces #56616

@tom-sherman

Description

@tom-sherman

Link to the code that reproduces this issue

https://github.com/tom-sherman/next-abortsignal-timeout-stack-trace-bug

To Reproduce

  1. next dev or next build && next start
  2. Navigate to /

Current vs. Expected behavior

Current:

An error is thrown that has an unhelpful stack trace.

DOMException [TimeoutError]: The operation was aborted due to timeout
    at Object.fetch (node:internal/deps/undici/undici:14062:11)

Expected:

Stack trace should point to the component/funciton that calls the aborted fetch.

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000
Binaries:
  Node: 18.13.0
  npm: 8.13.2
  Yarn: 1.22.19
  pnpm: 8.6.6
Relevant Packages:
  next: 13.5.5-canary.2
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

App Router

Additional context

It's important for these stack traces to exist because we need to be able to debug where fetches are aborted due to timeouts or other reasons.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions