I want to use SES Services with Vapor 4 to send an Email with my own route.
I follow step by step the recommendation in Soto Doc to use Vapor 4.
But I got this error : AsyncHTTPClient/HTTPClient.swift:591: Precondition failed: Provided EventLoop must be part of clients EventLoopGroup.
Some one can give me some explanations or explain how can I implement Soto SES with Vapor.
Thanks :)
I follow the Soto SDK documentation to implement SES Services but it's not working
This issue lacks some code samples of how you set it up, but I'm assuming the following:
You can access
application.http.client.sharedto use Vapor's instance ofAsyncHTTPClientinstead as such:Vapor's
req.eventLoopis part of an EventLoopGroup (multiple threads with EventLoops), and gets one of those threads assigned to it.If you then call
aws.ses.sendEmail(sendEmailRequest, on: req.eventLoop), thaton:parameter must be an EventLoop that is part of a group used for the AsyncHTTPClient. If you use.createNewto create a new HTTPClient, it'll create a separate EventLoopGroup from Vapor's. So your request will not use a valid thread for AsyncHTTPClient. While you can still use the AsyncHTTPClient's EventLoop for the request, it's definitely recommended to re-use the AsyncHTTPClient Vapor has here.