Skip to content

fetch('/') in the Repl causing infinite errors #59731

@jasnell

Description

@jasnell

Version

24.7.0

Platform

All

Subsystem

repl

What steps will reproduce the bug?

Open the repl, type fetch('/'). ... (the period at the end triggers it)

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

It should print a single error because the URL is not absolute...

What do you see instead?

The repl enters a busy loop trying to parse the URL over and over

...
> Uncaught [TypeError: Failed to parse URL from /] {
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:826:25)
      at new Request (node:internal/deps/undici/undici:10150:25)
      at fetch (node:internal/deps/undici/undici:10920:25)
      at fetch (node:internal/deps/undici/undici:15443:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
      at REPL199480:1:7
      at ContextifyScript.runInThisContext (node:vm:137:12)
      at REPLServer.defaultEval (node:repl:599:22)
      at bound (node:domain:433:15)
      at REPLServer.runBound [as eval] (node:domain:444:12) {
    code: 'ERR_INVALID_URL',
    input: '/'
  }
}
> Uncaught [TypeError: Failed to parse URL from /] {
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:826:25)
      at new Request (node:internal/deps/undici/undici:10150:25)
      at fetch (node:internal/deps/undici/undici:10920:25)
      at fetch (node:internal/deps/undici/undici:15443:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
      at REPL199481:1:7
      at ContextifyScript.runInThisContext (node:vm:137:12)
      at REPLServer.defaultEval (node:repl:599:22)
      at bound (node:domain:433:15)
      at REPLServer.runBound [as eval] (node:domain:444:12) {
    code: 'ERR_INVALID_URL',
    input: '/'
  }
}
> Uncaught [TypeError: Failed to parse URL from /] {
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:826:25)
      at new Request (node:internal/deps/undici/undici:10150:25)
      at fetch (node:internal/deps/undici/undici:10920:25)
      at fetch (node:internal/deps/undici/undici:15443:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
      at REPL199482:1:7
      at ContextifyScript.runInThisContext (node:vm:137:12)
      at REPLServer.defaultEval (node:repl:599:22)
      at bound (node:domain:433:15)
      at REPLServer.runBound [as eval] (node:domain:444:12) {
    code: 'ERR_INVALID_URL',
    input: '/'
  }
}
> Uncaught [TypeError: Failed to parse URL from /] {
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:826:25)
      at new Request (node:internal/deps/undici/undici:10150:25)
      at fetch (node:internal/deps/undici/undici:10920:25)
      at fetch (node:internal/deps/undici/undici:15443:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
      at REPL199483:1:7
      at ContextifyScript.runInThisContext (node:vm:137:12)
      at REPLServer.defaultEval (node:repl:599:22)
      at bound (node:domain:433:15)
      at REPLServer.runBound [as eval] (node:domain:444:12) {
    code: 'ERR_INVALID_URL',
    input: '/'
  }
}
> zsh: killed     node

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions