Skip to content

Pagination error #753

@dancixx

Description

@dancixx

Describe the bug

I have the following pagination impl:

  let stripe = Client::new(&*STRIPE_API_KEY);

  let last_invoice_id = select_latest_invoice_id().bind(&db).one().await;
  if last_invoice_id.as_ref().is_err() {
    tracing::error!("Error fetching latest invoice ID: {:?}", last_invoice_id);
    return Err(format!("Error fetching latest invoice ID: {:?}", last_invoice_id).into());
  }
  let params = ListInvoices {
    limit: Some(100),
    expand: &["data.lines.data"],
    ending_before: Some(InvoiceId::from_str(&last_invoice_id?)?),
    ..Default::default()
  };
  let paginator = Invoice::list(&stripe, &params).await?.paginate(params);
  let mut stream = paginator.stream(&stripe);

and I am getting this error

Stripe paginator item error (skipping): Stripe(RequestError { http_status: 400, error_type: InvalidRequest, message: Some("Received both starting_after and ending_before parameters. Please pass in only one."), code: None, decline_code: None, charge: None })

It is working when I am using the start_after.

To Reproduce

Follow the implementation.

Expected behavior

Dont getting error if the starting_after not passed.

Code snippets

OS

macOS

Rust version

1.88.0

Library version

async-stripe 0.40

API version

2022-11-15

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions