arlyon / async-stripe

Async (and blocking!) Rust bindings for the Stripe API
https://payments.rs
Apache License 2.0
467 stars 131 forks source link

Async-Stripe compilation failing due to runtime requirement and unable to solely extract structs #631

Open WarrenN1 opened 3 weeks ago

WarrenN1 commented 3 weeks ago

Describe the bug

I am compiling via wasm32-unknown-unknown and I have structs that contain stripe IDs. I would like to be able to serialize etc. which is all supported, but the TLS and tokio is not supported in WASM and therefore the stripe async library will not compile.

I need to simply import only the structs and not the client. In library terms, importing ids, resources and none of the client and/or async dependencies.

To Reproduce

Create a trunk project and then set a dependency for async-strip = async-stripe = { version = "*", features = [""]}

Expected behavior

There should be a way to import just the structs with serialization etc. without importing the client.

Code snippets

No response

OS

Ubuntu 22

Rust version

rustc 1.82.0 (f6e511eec 2024-10-15)

Library version

0.15.1

API version

2020-08-07

Additional context

No response

omarabid commented 1 week ago

add default-feature = false to prevent the tokio runtime from being pulled.

WarrenN1 commented 1 week ago

This does not work. It causes the entire library to not be imported because the library seems to mandate a runtime.,

omarabid commented 1 week ago

You need to make your own implementation of the Client that uses Cloudflare worker Fetch and wait_until.