async-stripe icon indicating copy to clipboard operation
async-stripe copied to clipboard

Certain feature combination does not compile

Open dthul opened this issue 3 years ago • 9 comments

I'm using the following line in my Cargo.toml:

async-stripe = { version = "0.13", default-features = false, features = ["runtime-tokio-hyper-rustls", "billing", "webhook-events"] }

and this is the compile error I get:

   Compiling async-stripe v0.13.0
error[E0432]: unresolved import `crate::resources::CheckoutSessionItem`
  --> /home/dthul/.cargo/registry/src/github.com-1ecc6299db9ec823/async-stripe-0.13.0/src/resources/generated/quote.rs:11:14
   |
11 |     Account, CheckoutSessionItem, Currency, Customer, Discount, Invoice,
   |              ^^^^^^^^^^^^^^^^^^^
   |              |
   |              no `CheckoutSessionItem` in `resources`
   |              help: a similar name exists in the module: `CheckoutSession`

As far as I can tell CheckoutSessionItem will only be re-exported from crate::resources when the checkout Cargo feature is activated. As a quick fix I changed my dependency line to:

async-stripe = { version = "0.13", default-features = false, features = ["runtime-tokio-hyper-rustls", "billing", "webhook-events", "checkout"] }

dthul avatar Jan 11 '22 18:01 dthul

Thanks for the report. I'll have a look and see if we can either a) rework the deps or b) at least document this requirement.

arlyon avatar Jan 12 '22 08:01 arlyon

We are planning on addressing this issue with 0.15 where we will split out the codegen into crates. This will make the dependencies much more explicit. Stay tuned.

arlyon avatar Mar 22 '22 14:03 arlyon

Hi @arlyon I am experiencing similar issue as @dthul .

And also trying to undestand which feature I have to enable to make use stripe::TerminalLocation; to compile, it complains

6 | use stripe::TerminalLocation;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^ no `TerminalLocation` in the root

I have noticed that this code is generated https://github.com/arlyon/async-stripe/blob/ca5269ebcf9cbd7005f3fecedc63cc31718680a6/src/resources/generated/terminal_location.rs

Tried to add "terminal" or "terminal-location" features, but none of them worked:

the package `my_example` depends on `async-stripe`, with features: `terminal-location` but `async-stripe` does not have these features.

fancywriter avatar May 04 '22 12:05 fancywriter

Hi

The terminal APIs are currently not exported (and untested). I will write a PR to add them and you can provide feedback. Everything should 'just work' after that.

See here for a list of unexported APIs (updated weekly with): https://github.com/arlyon/async-stripe/pull/216

I am adding terminal support in this PR: https://github.com/arlyon/async-stripe/pull/221

arlyon avatar May 04 '22 13:05 arlyon

The pr is merged let me know if there are any issues with the terminal API.

arlyon avatar May 04 '22 14:05 arlyon

When I updated to v0.15 I ran into a new but similar compile issue. The Cargo.toml line I used:

async-stripe = { version = "0.15", default-features = false, features = ["runtime-tokio-hyper-rustls", "billing", "webhook-events", "checkout"] }

which leads to this error:

    Checking async-stripe v0.15.0
error[E0412]: cannot find type `AccountCapabilities` in this scope
   --> /home/dthul/.cargo/registry/src/github.com-1ecc6299db9ec823/async-stripe-0.15.0/src/resources/webhook_events.rs:444:25
    |
444 |     AccountCapabilities(AccountCapabilities),
    |                         ^^^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: there is an enum variant `crate::EventObject::AccountCapabilities`; try using the variant's enum
    |
444 |     AccountCapabilities(crate::EventObject),
    |                         ~~~~~~~~~~~~~~~~~~

and the new line which makes it work (by adding the "connect" feature which will re-export the AccountCapabilities struct):

async-stripe = { version = "0.15", default-features = false, features = ["runtime-tokio-hyper-rustls", "billing", "webhook-events", "checkout", "connect"] }

dthul avatar Jun 10 '22 15:06 dthul

I also bumped into this. I only need the webhook-events feature in addition to runtime.

In my case this works

async-stripe = { version = "0.15.0", default-features = false, features = ["runtime-tokio-hyper", "webhook-events", "connect", "checkout"]}

It seems like webhook-events should also activate connect and checkout

cortopy avatar Jun 11 '22 09:06 cortopy

Copying from #238: after updating to 0.15.0, a set of features that built fine in 0.14.1 now doesn't compile. A minimal Cargo.toml which compiles for 0.14 but not 0.15.0:

[dependencies]
async-stripe = {version = "0.15.0", default-features = false, features = ["runtime-tokio-hyper", "webhook-events", "checkout"]}

The compilation error:

error[E0412]: cannot find type `AccountCapabilities` in this scope
   --> /Users/matthewzeitlin/.cargo/registry/src/github.com-1ecc6299db9ec823/async-stripe-0.15.0/src/resources/webhook_events.rs:444:25
    |
444 |     AccountCapabilities(AccountCapabilities),
    |                         ^^^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: there is an enum variant `crate::EventObject::AccountCapabilities`; try using the variant's enum
    |
444 |     AccountCapabilities(crate::EventObject),
    |                         ~~~~~~~~~~~~~~~~~~

Adding the feature connect fixes this compilation error.

mzeitlin11 avatar Jun 15 '22 22:06 mzeitlin11