cloudflare / cloudflare/workers-sdk

Paths are not properly mapped for debugging

Open
#9,997 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
186

Description

### What versions & operating system are you using?

Wrangler v4.24, Node v22, Linux

### Please provide a link to a minimal reproduction

_No response_

### Describe the Bug

I'm trying to debug a Workers application using the [vscode JS debug adapter](https://github.com/microsoft/vscode-js-debug).

Recently, I discovered that source paths are not properly mapped. This affects almost no files (hence why it has gone unnoticed), but when a path contains brackets, it's impossible to add a breakpoint (it becomes unbound).

This happens because the adapter sends the escaped path **literally** to the DAP client. For instance, the `source.path` is `/path/to/%5Bfoo%5D.ts`, when it should be `file:///path/to/%5Bfoo%5D.ts`, so the client knows it's a schema, and not a literal file.

I'm actually not sure if this issue is caused by Workers or if it's something that should be fixed elsewhere. If here's the wrong place, can you give me some pointers on where should I go? Should I report this to vscode-js-debug instead?

The reason I'm reporting here first is that I can't repro outside a Workers environment,so it must be related. In fact, the repro is as simple as:

1. Creating a Workers project (e.g., from the [quickstart](https://developers.cloudflare.com/workers/get-started/guide/#1-create-a-new-worker-project))
2. Configuring a debug setup and
3. Adding a **`[foo].ts`** file with some basic content, e.g.
```ts
export function sum(a: number, b: number) {
return a + b
}
```
4. Trying to add a breakpoint (or calling the function and trying to step into it)

I can provide additional details if necessary.

### Please provide any relevant error logs

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.