Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breakpoint debugging with VSCode #3

Open
wallabyway opened this issue Apr 29, 2024 · 0 comments
Open

breakpoint debugging with VSCode #3

wallabyway opened this issue Apr 29, 2024 · 0 comments

Comments

@wallabyway
Copy link

wallabyway commented Apr 29, 2024

I cannot debug locally with this example.

The example runs locally in a browser correctly.
I set break points, but none are active, and the Hono server code does not hit a breakpoint.

Specifically:
In the vscode terminal, I do ...

  1. rpm run preview
  2. VSCode debug tab, I click 'play' (wrangler)
  3. The service attaches correctly
  4. I set break points in app/server.ts, db.ts, but none are active and none are ever hit.

No breakpoints can be hit, yet VSCode debugger has attached.

Also, when I click 'd' to open DevTools, nothing happens.

I'm not clear on what I'm doing wrong with my setup, but I suspect it has something to do with 'preview' command, being pages.

My package.json is
  "scripts": {
    "dev": "vite",
    "build": "vite build --mode client && vite build",
    "preview": "wrangler pages dev ./dist --compatibility-date=2024-03-13",
    "deploy": "npm run build && wrangler pages deploy ./dist"
  },



My launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Wrangler",
            "type": "node",
            "request": "attach",
            "port": 9229,
            "cwd": "/",
            "resolveSourceMapLocations": null,
            "attachExistingChildren": false,
            "autoAttachChildProcesses": false,
            "sourceMaps": true // works with or without this line
          }
    ]
}

and the logs show

npm run preview

> preview
> wrangler pages dev ./dist --compatibility-date=2024-03-13

✨ Compiled Worker successfully
 ⛅️ wrangler 3.52.0
-------------------
Your worker has access to the following bindings:
- D1 Databases:
  - DB: STAFFDB1 (removed)
- R2 Buckets:
  - MY_BUCKET: staffbucket1
⎔ Starting local server...
[wrangler:inf] Ready on http://localhost:8788
GET   /
GET   /employee/:id
POST  /admin/create
GET   /admin
GET   /*
╭───────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit        
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant