Skip to content

Failure to run wstd http-client example wasm binary #577

Open
@dragonflyfree

Description

@dragonflyfree

https://github.com/yoshuawuyts/wstd/blob/main/examples/http_client.rs
cargo 1.87.0-nightly (1d1d646c0 2025-02-21), Rust edition 2021, cargo component build --release --target wasm32-wasip2

import { run } from "./transpiled/wstd-example.js"

console.log(run.run())

When running node index.js https://example.com:

> GET / HTTP/1.1
< HTTP/1.1 200 OK
< content-type: text/html
< etag: "84238dfc8092e5d9c0dac8ef93371a07:1736799080.121134"
< last-modified: Mon, 13 Jan 2025 20:11:20 GMT
< cache-control: max-age=697
< date: Wed, 26 Feb 2025 04:00:26 GMT
< alt-svc: h3=":443"; ma=93600,h3-29=":443"; ma=93600,quic=":443"; ma=93600; v="43"
< content-length: 1256
< connection: keep-alive
.../node_modules/@bytecodealliance/preview2-shim/lib/io/worker-io.js:323
      { src: src.#id, len }
                 ^

TypeError: Cannot read private member #id from an object whose class did not declare it
    at OutputStream.splice (.../node_modules/@bytecodealliance/preview2-shim/lib/io/worker-io.js:323:18)      
    at trampoline56 (.../transpiled/wstd-example.js:2917:34)
    at wit-component:shim.indirect-wasi:io/streams@0.2.3-[method]output-stream.splice (wasm://wasm/wit-component:shim-b13bbaba:wasm-function[16]:0x283)
    at wasm://wasm/001e552a:wasm-function[184]:0x7504
    at wasm://wasm/001e552a:wasm-function[281]:0x16dc8
    at wasm://wasm/001e552a:wasm-function[279]:0x103e0
    at wasm://wasm/001e552a:wasm-function[96]:0x3286
    at wasm://wasm/001e552a:wasm-function[329]:0x24c61
    at wasm://wasm/001e552a:wasm-function[61]:0x148e
    at wit-component:adapter:wasi_snapshot_preview1.wasi:cli/run@0.2.3#run (wasm://wasm/wit-component:adapter:wasi_snapshot_preview1-2fd92fea:wasm-function[29]:0x701)

Node.js v22.5.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions