sveltejs / sveltejs/kit

`resolve(...)` works incorrectly inside a remote function

Open
#14,537 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

In a remote function, event.url.pathname is always / (because the actual pathname of the generated endpoint is an implementation detail that shouldn't be relied upon).

That means that resolve(...) will always return a pathname that's resolved from the root, which generally isn't what people intend, since they can't then use the pathname for anything useful.

We could fall back to non-relative resolution in this case, but that would cause breakage for people who rely on relative pathnames. Or we could just forbid its use altogether. Not sure.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how resolve(...) uses event.url.pathname inside remote functions, where the pathname is always /. Compare the compatibility impact of non-relative fallback versus forbidding this use, then define and test the intended behavior for relative pathnames.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.