Skip to content

Understanding the differences between Spin and Wasmtime in wasip2 imports resolution #3275

@alepvn33

Description

@alepvn33

Hello everyone,

I am relatively new to Spin, so I am trying to understand how to use it. This issue is mainly a request for a technical explanation more than a problem with Spin.

I was studying the http-rust example (https://github.com/spinframework/spin/tree/main/examples/http-rust).
I noticed that while Spin can run the compiled module, Wasmtime cannot. When running the module with Wasmtime, I get:

Error: failed to run main module 'http_rust.wasm'

Caused by:
    0: failed to instantiate "http_rust.wasm"
    1: unknown import: 'wasi:io/streams@0.2.0-rc-2023-10-18::[resource-drop]output-stream' has not been defined

Since Spin is built upon Wasmtime, why is Spin able to provide this import while Wasmtime isn't? Wasmtime includes a wasi-io crate in its codebase (https://github.com/bytecodealliance/wasmtime/tree/3cc0023cb60295ee15931d40b266d723f4598eba/crates/wasi-io), so I would expect it to be able to run the example module as well.

Does anyone know why there is this difference in behavior between Spin and Wasmtime when it comes to resolving wasip2 imports?

Thanks in advance for your help :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions