arlyon/async-stripe

Error when constructing event

Closed this issue · 1 comments

Describe the bug

When constructing the webhook event it something happens with the body so every event fails.

To Reproduce

This code

  let payload_str = std::str::from_utf8(&payload).unwrap();
  let stripe_signature = get_header(&req, "Stripe-Signature").unwrap_or_default();
  let stripe_secret_key = c.config.get_stripe_webhook_secret().await;
  let event = match Webhook::construct_event(payload_str, stripe_signature, &stripe_secret_key) {
    Ok(event) => event,
    Err(e) => {
      eprintln!("Error constructing event: {:?} {:?}", e, payload_str);
      return Ok(());
    }
  };

Every single event it goes to the Err and prints error

Error constructing event: BadParse(Error("unknown variant `self`, expected `account` or `self_`", line: 133, column: 3))

Expected behavior

It parses the event like it should

Code snippets

No response

OS

Not relevant

Rust version

1.77.0-nightly - but not relevant

Library version

0.31.0

API version

2023-10-16

Additional context

No response

I believe this is related to #490, so should get fixed once that gets merged.