Skip to content
Back

SSL Certification Error in self-hosted instance

  • 0
  • Self Hosted
  • Web
Tanmay Juneja
30 Dec, 2023, 08:53

Hello there! I've setup the self-hosted Appwrite instance using docker in an EC2 instance for the first time and I am getting this error. How can I resolve this? Please help. Thanks!

TypeScript
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1007)

During handling of the above exception, another exception occurred:

SSLError                                  Traceback (most recent call last)
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1007)

The above exception was the direct cause of the following exception:

MaxRetryError                             Traceback (most recent call last)
MaxRetryError: HTTPSConnectionPool(host='65.x.x.xxx', port=443): Max retries exceeded with url: /v1/databases/65029fc22a51f570ac8e/collections/6502a3fe273c4ae263bf/documents (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1007)')))
TL;DR
Issue: SSL Certification Error in self-hosted instance Solution: - Add an 'A' record in DNS records pointing to the EC2 instances IP address. - Set the `_APP_DOMAIN` variable in the `.env` file to the domain name used to access Appwrite. - Restart Appwrite using `docker compose up -d`. - Appwrite will generate an SSL certificate for the new domain. - If the issue persists, consider connecting a domain to the EC2 instance to generate a valid certificate.
Drake
30 Dec, 2023, 18:32

This error is expected because you don't have a valid certificate.

You're using the web sdk client side?

Tanmay Juneja
1 Jan, 2024, 12:19

Thanks a lot @Steven yes I am using python SDK from Colab notebooks to test the server. I will be using python and JS SDK in serverless functions. How can I create a valid certificate? I followed the steps provided in Appwrite docs, but it showed error on the EC2 instance. We have a domain - blozum.com. Do I need to connect a domain with this instance to generate this valid certificate? Can you please guide?

ideclon
1 Jan, 2024, 12:23

Yes, it’s almost impossible (if you’re not a huge corporation) to get an SSL certificate for an IP address. You’ll need to set up a domain pointed at your Appwrite instance and set that domain in your appwrite/.env file as _APP_DOMAIN, then restart Appwrite (with docker compose up -d. Appwrite should then generate you an SSL certificate.

Tanmay Juneja
1 Jan, 2024, 12:25

Understood @ideclon . Will try to do this and ask if I have anymore doubts.

  1. If I add an 'A' name domain, then it would work, right?
  2. How can I add this domain? Where should I point this new domain to? (The value of the domain)
ideclon
1 Jan, 2024, 12:26

Your domain should be pointed at your Appwrite server. Then set _APP_DOMAIN to that domain

Tanmay Juneja
1 Jan, 2024, 13:04

Understood. Thanks a lot!

ideclon
1 Jan, 2024, 13:08

If your issue has been solved, you can mark this post as closed by adding “[SOLVED]” to the beginning of the title

Tanmay Juneja
1 Jan, 2024, 13:44

I havent tried this yet. I will try and reopen a ticket if my issue wouldn't have been resolved.

Tanmay Juneja
2 Jan, 2024, 10:27

Hello @ideclon @Steven !

I tried the above solution but it is still not working. Please help. I have added an 'A' record in my DNS records (as adding in 'CNAME' was showing "Record data is invalid."). Currently, my Appwrite is hosted on AWS EC2 Public IPv4 address - 65.1.108.139. I've tried changing the appwrite variable names, but it still doesn't work.

Currently, my .env variables are:- _APP_DOMAIN=65.1.108.139 _APP_DOMAIN_TARGET=65.1.108.139

Please help as I don't know what to do next. I updated the DNS records yesterday and have generally seen the DNS records to get updated within a day. I don't know if that might be the issue.

ideclon
2 Jan, 2024, 13:05

The mentioned .env variables should be set to the domain name you use to access Appwrite

ideclon
2 Jan, 2024, 13:06

A records point to IPv4 addresses, AAAA records point to IPv6 addresses, CNAME records point to other domain names.

Tanmay Juneja
2 Jan, 2024, 16:45

Yes, I have set them appwrite.blozum.com now. Still, it is not working.

Tanmay Juneja
2 Jan, 2024, 16:48

Which one should I use? Please help as I don't know a lot about the IP addresses. I have an AWS EC2 server where I've hosted Appwrite, and the domain is for my startup, Blozum.com.

ideclon
2 Jan, 2024, 16:49

You should have an A record for appwrite.blozum.com pointing at your EC2 instances IP address

Tanmay Juneja
3 Jan, 2024, 05:22

Thanks, it's resolved now. 🙂

ideclon
3 Jan, 2024, 05:25

Great! If your issue has been solved, you can mark this post as closed by adding “[SOLVED]” to the beginning of the title

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more