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

deno_emit fails depending on whether or not a breakpoint is set. #15015

Open
jespertheend opened this issue Jun 29, 2022 · 4 comments
Open

deno_emit fails depending on whether or not a breakpoint is set. #15015

jespertheend opened this issue Jun 29, 2022 · 4 comments
Labels
bug Something isn't working correctly

Comments

@jespertheend
Copy link
Contributor

Not sure if this is a Deno issue, or a deno_emit issue, but it seems like debugging shouldn't affect the code like this so I'm assuming this is an issue with Deno.

To reproduce:

  • create emit.js
import {emit} from "https://deno.land/x/[email protected]/mod.ts";

const result = await emit(new URL("https://deno.land/[email protected]/path/mod.ts"));
console.log(result);
  • Run deno run -A --unstable --inspect-brk emit.js
  • Connect a debugger (I'm using vscode since Chrome DevTools can't place breakpoints on files that haven't been run yet)
  • place a breakpoint at the console.log line.
  • Resume the debugger.

Actual result
Uncaught (in promise) TypeError: WebAssembly.compile(): Argument 0 must be a buffer source

Expected result
The code runs without any errors.

Some things to note:

  • removing the breakpoint seems to make the code run, but when the process is done it keeps hanging rather than exiting automatically.
  • removing --inspect-brk make the code run like normal.
  • Enabling 'break on caught/uncaught exceptions' doesn't actually pause the debugger when the promise rejects, though I think I've seen this happen before with promises so this might be intended.
@dsherret dsherret added the bug Something isn't working correctly label Jun 30, 2022
@Benjamin-Dobell
Copy link

Same issue is reported over at denoland/vscode_deno#708 and I'm seeing the same when attempting to debug in IntelliJ. All good until the code transitions into some WASM, then we get the error above and execution terminates.

@frdel
Copy link

frdel commented Mar 21, 2023

Having the same issue. deno_emit import fails with error Uncaught (in promise) TypeError: WebAssembly.compile(): Argument 0 must be a buffer source when launching in vs code. Is there still no cure for this?

@santidhammo
Copy link

The same thing appears to happen with the bundle function, and indeed using IntelliJ only occurs when debugging, if running without debugging the output appears to be alright, so it does appear to have to do with the --inspect-brk option.

@CalvinWilkinson
Copy link

CalvinWilkinson commented Mar 18, 2024

I am also having the same issue when using emit() and bundle.

If I use the current default launch config shown below which uses --inspect-wait, I get the error

    "version": "0.2.0",
    "configurations": [
        {
            "request": "launch",
            "name": "Launch Program",
            "type": "node",
            "program": "${workspaceFolder}/main.ts",
            "cwd": "${workspaceFolder}",
            "runtimeExecutable": "C:\\Users\\kinso\\.deno\\bin\\deno.EXE",
            "runtimeArgs": [
                "run",
                "--inspect-wait",
                "--allow-all"
            ],
            "attachSimplePort": 9229
        }
    ]

But if I just execute the script using the deno CLI, everything works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

6 participants