Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Failed #128

Closed
siciliano2281 opened this issue May 6, 2021 · 4 comments
Closed

Assertion Failed #128

siciliano2281 opened this issue May 6, 2021 · 4 comments

Comments

@siciliano2281
Copy link

I receive the following error in the console:

Assertion failed: file AsyncHTTPClient/HTTPClient.swift, line 117 2021-05-06 16:19:12.537202-0400 Run[9051:882865] Assertion failed: file AsyncHTTPClient/HTTPClient.swift, line 117

when running the following code:

`
func createCustomerStripe(_ req: Request) throws -> EventLoopFuture {

    print("createCustomerStripe called.")
    
    let customerFromClient = try req.content.decode(CustomersDTO.self)

    let httpClient = HTTPClient(eventLoopGroupProvider: .shared(req.eventLoop))
    let stripe = StripeClient(httpClient: httpClient, eventLoop: req.eventLoop, apiKey: "test_key")
    
    let newCustomer = stripe.customers.create(email: customerFromClient.email,
                                              name: customerFromClient.name,
                                              phone: customerFromClient.phone)
    
    return newCustomer
}

`

IMPORTANT: Stripe receives each new customer when this func is called. A new customer is created with the data submitted (email, name, phone). Stripe Logs show no errors. However, Vapor crashes. Please help!

@Andrewangeta
Copy link
Member

I recommend using the Stripe Vapor package vs Stripe-Kit directly. But essentially you're not hopping to the requests event loop with the stripe client.

@siciliano2281
Copy link
Author

OK, should I remove the Stripe-Kit package?

@Andrewangeta
Copy link
Member

Yes

@siciliano2281
Copy link
Author

Got it, thanks for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants