#nimby_09436

1 messages · Page 1 of 1 (latest)

broken ingotBOT
haughty ferry
#

Hi there 👋 can you tell me more about what you're trying to do, are you trying to make a list request to retrieve a list of Customers?

proper fern
#

Yes, list of customers with a given email address

haughty ferry
#

Gotcha, can you share the snippet of code you're running that is encountering this error?

proper fern
#

@GetMapping("/getCustomers")
public ResponseEntity<?> getStripeCustomers(@RequestParam String email) {
try {
List<Customer> customers = stripeService.getCustomersByEmail(email);
return ResponseEntity.ok(customers);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
public List<Customer> getCustomersByEmail(String email) throws StripeException {
Stripe.apiKey = secretKey;

    CustomerCollection customers = Customer.list(
        new HashMap<String, Object>() {{
            put("email", email);
            put("limit", 9999);
        }}
    );

    return customers.getData();
}
#

In a controller file and a service file

haughty ferry
#

I'm not sure if it's causing the error, but limit can't be that high. It caps at 100.

proper fern
#

Okay thanks

#

I still have the error, do you have any other ideas? Is it related to the jackson version possibly?

turbid phoenix
#

I see No serializer found for class com.stripe.model.Customer$TestHelpers in the error you shared but no reference to test helpers in the snippet

#

Are you using test helpers?

#

Can you share the exact stripe-java version you use?

proper fern
#

I'm using version 23.6.0 and no test helpers in my code

turbid phoenix
#

Are you seeing the request reaching Stripe in your logs? ie, is it failing on the way out, or in parsing the response?

proper fern
#

I don't see any /customers in my logs

#

Sorry, I had it on post instead of get, I can now see the /customers

broken ingotBOT
proper fern
#

Any ideas?

turbid phoenix
#

Sorry, i should have been more specific, can you share the request ID that you see for this list request?

#

eg, req_123

proper fern
#

sure: req_u1QAwsqZU7Fxrh

turbid phoenix
#

It sounds like the request is succeeding, but your client/sdk is failing to handle the result

proper fern
#

Yes that's probably correct, just unsure what it is that is failing

turbid phoenix
#

Hmm looking at your code, i'm wondering if this is a mismatch between CustomerCollection and List<Customer>?

#

If the Customer.list() call succeeds, but then this breaks when you return customers.getData();

proper fern
#

Okay, the getStripeCustomers previously had a return type of ResponseEntity<List<Custome>> which failed to run, so I think that would suggest that too

#

Is there a way I can resolve that?

turbid phoenix
#

Well where do things break?

#

Does this part work:

 CustomerCollection customers = Customer.list(
            new HashMap<String, Object>() {{
                put("email", email);
                put("limit", 9999);
            }}
        );

        return customers.getData();

ie, can you log those customers or getData()?

proper fern
#

I'll try that now

#

I can see an ArrayList of customers in getData()

broken ingotBOT
turbid phoenix
#

Looping back here, since I need to step away soon: were you able to identify exactly where the error is thrown? Is it the return from your method, or somewhere else?