Skip to content

No access to Env in #[wasm_bindgen] RPC functions #720

@ilijaljubicic

Description

@ilijaljubicic

It seems it is currently not possible to access the Env inside functions exposed via #[wasm_bindgen] and used in Workers RPC. This limitation makes it difficult to use RPC endpoints for any functionality that depends on environment bindings (e.g., Hyperdrive, secrets, KV, etc.).

#[wasm_bindgen]
pub async fn add(a: u32, b: u32) -> u32 {   
    // Access Env somehow....
    a + b
}

There should be a way to access the Env, similar to how it is provided to the fetch handler.

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