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

AWS_SES_REGION_ENDPOINT connection error #258

Open
jihoon-MRX opened this issue Sep 20, 2022 · 11 comments
Open

AWS_SES_REGION_ENDPOINT connection error #258

jihoon-MRX opened this issue Sep 20, 2022 · 11 comments

Comments

@jihoon-MRX
Copy link

jihoon-MRX commented Sep 20, 2022

If I assign ses smtp endpoint such as 'email-smtp.ap-northeast-2.amazonaws.com' to AWS_SES_REGION_ENDPOINT on settings, it seems that it cannot be connected to the SES Server.
However, if I assign region to AWS_SES_REGION_NAME only, it works perfectly.

Am I missing something or any updates for this?

@pcraciunoiu
Copy link
Contributor

It looks like you have a typo in the message, AWS_SES_REGION_ENDPOINT but yours says AWS_SES_REGION_ENPOINT (missing D in ENPOINT). Maybe that's it?

@jihoon-MRX
Copy link
Author

That tydo was in the message only, not in my project. Thanks tho, I corrected it.

@abheysharma23
Copy link

you found the solution?

@jmbreiner
Copy link

jmbreiner commented May 4, 2023

OH MY GOODNESS THANK YOU!!!!! This totally solved my problem. You can only define the AWS_SES_REGION_NAME and leave out the AWS_SES_REGION_ENDPOINT or it won't work. jihoon-MRX, you are amazing. Thank you!!

@pcraciunoiu
Copy link
Contributor

@jmbreiner would you open a PR to document this? Or do you recommend something else to help future people avoid this issue?

@ale180192
Copy link

In the documentation, there is an example of how to put the region name endpoint like AWS_SES_REGION_ENDPOINT = 'email.us-west-2.amazonaws.com', and this value is passed directly to the boto client. However, in the boto client documentation, it says: endpoint_url (string) – The complete URL to use for the constructed client. Normally, botocore will automatically construct the appropriate URL to use when communicating with a service. You can specify a complete URL (including the "http/https" scheme) to override this behavior. If this value is provided, then use_ssl is ignored. This means we need to include the "https" scheme in the URL.

I believe we can update the documentation to avoid confusion with this requirement. Additionally, it's worth noting that the Django settings used by the SESBackend class is AWS_SES_REGION_ENDPOINT_URL, not AWS_SES_REGION_ENDPOINT.

Here's the relevant code snippet from the SESBackend class:

super(SESBackend, self).init(fail_silently=fail_silently, **kwargs)
self._access_key_id = aws_access_key or settings.ACCESS_KEY
self._access_key = aws_secret_key or settings.SECRET_KEY
self._session_token = aws_session_token or settings.SESSION_TOKEN
self._region_name = aws_region_name if aws_region_name else settings.AWS_SES_REGION_NAME
self._endpoint_url = aws_region_endpoint if aws_region_endpoint else settings.AWS_SES_REGION_ENDPOINT_URL
self._throttle = cast_nonzero_to_float(aws_auto_throttle or settings.AWS_SES_AUTO_THROTTLE)
self._config = aws_config or settings.AWS_SES_CONFIG

I hope this clarification helps to improve the documentation and avoid potential issues with the SES endpoint URL.

@pcraciunoiu
Copy link
Contributor

@ale180192 thanks for this detail. Would you be interested in opening a PR to clarify the documentation?

@ale180192
Copy link

ale180192 commented Jul 26, 2023

Hi @pcraciunoiu sure!! I'd like to send a PR. Do I have to create a fork or how can I send the PR?

@pcraciunoiu
Copy link
Contributor

Yes @ale180192 you'd have to fork and use the GitHub editor or clone the repo and push to your fork

@MScatolin
Copy link

Based on this thread I was able to make it work using ACCESS_KEY and SECRET_KEY as variable names in settings.py (not the ones mentioned on readme. thank you @ale180192

Also removed the endpoint var as suggested by @jihoon-MRX and @jmbreiner. Thanks!

+1 for the PR. At least on the readme, if nothing. I might give it a try later, if you like.

@pcraciunoiu
Copy link
Contributor

@MScatolin you're welcome to PR it, I can review

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

No branches or pull requests

6 participants