next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Returning responses from Edge API routes that with non-fully qualified URLs lead to URL parse error

Open cramforce opened this issue 3 years ago • 1 comments

Verify canary release

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

Provide environment information

Local dev. [email protected]

What browser are you using? (if relevant)

n/a

How are you deploying your application? (if relevant)

Local dev

Describe the Bug

Responses like this from edge runtime lead to an error during local dev:

return Response(null, {
  status: 302
  headers: {location: "/path"}
})

This, however, is a valid HTTP response.

error - (middleware)/node_modules/next/dist/server/web/next-url.js (180:0) @ parseURL
error - Invalid URL: /en-us

Expected Behavior

Response is accepted.

Link to reproduction

n/a

To Reproduce

See above

cramforce avatar Aug 24 '22 16:08 cramforce

Also experiencing this on next.js 13 (using pages instead of appDir).

james-elicx avatar Oct 30 '22 12:10 james-elicx