#CNAME and A DNS records for Appwrite functions
1 messages · Page 1 of 1 (latest)
Everything gets validated, the domain is verified and the certificate created, how do I access that function?
If I go to myfunction.mydomain.com, I get a Error 400 type general_argument_invalid
(My function is working fine with a regular manual execution)
I don't even see a new execution on the list how do I get to that function with REST?
@still schooner do you know what could have gone wrong here?
To elaborate a little bit, if I setup a domain for the functions on my .env file I have to create an A record on my dns directly to my server, why is that appwrite asks or let config a CNAME for the function, that's what I don't get.
Is this all happening on Cloud or a self hosted instance?
If on self hosted, can you check if it works on Cloud?
You typical set up an A record to point a domain to an IP. Then, you can use CNAME records to point one domain to another domain. The benefit with this is if you move your server and it gets a new IP, you only need update that one A record.
Did you put mydomain.com in your .env file?
Self Hosted
yes, everything is in appwrite.mydomain.com
I have a project "Project 1" where I placed a CNAME to the whole project: api.myotherdomain.net
That's with that and I understand how it works, but for the functions tho, I think is a little bit messy or maybe I'm overthinking it, but
On the functions setting why there is a CNAME input when if I create that CNAME of like: function1.mythirddomain.org pointing also to my main appwrite.mydomain.com, so I can call the function with curl or axios, that won't work, I'm just creating a CNAME for the whole project. If I want a domain and subdomain for that function I need a A record pointing to the IP because the CNAME won't work
Creating a cname should work. What problem are you facing?
I have this function where I created a CNAME fun.myotherdomain.com pointing to my appwrite.mydomain.com
If i go the fun.myotherdomain.com, I get this
And there is no execution
And what gave you configured for the domain environment variables in your .env file?
And what version of Appwrite are you on?
_APP_DOMAIN=appwrite.mydomain.com
_APP_DOMAIN_FUNCTIONS=
_APP_DOMAIN_TARGET=appwrite.mydomain.com
had 1.4.9, just updated to 1.4.12, still the same
Just ins case, permissions are set to Any
Hmm I wonder if you need something configured for app domain functions...
So if I add a domain to _APP_DOMAIN_FUNCTIONS, like functions.myextradomain.com, I will get a function domain as <function_id>.functions.myextradomain.com and I will have to create a A record on my DNS and point it to the IP address of the server, but that's a different story
Never mind I don't think it's needed
So this is where the error is thrown: https://github.com/appwrite/appwrite/blob/5a715ff68cba4171bf3473eabc83b84a4ae5876c/app/controllers/general.php#L159
Anything in your Appwrite docker logs?
Oh wait. Looks like you do have to set something for your this env var
You only need 1 cname record that points *.whatever.com to your appwrite instance
Can you elaborate please
ok, so it would be <function_id>.mycname.com ?
For that I would need a A record
If that's the case, this CNAME inside the function would be useless, it would be the same as the project CNAME
No, a cname record pointing *.mycame.com to your appwrite instance
The custom function domain is for an additional custom one different than the default function domain
For example, on cloud we have our app domain as cloud.appwrite.io. we have *.appwrite.global pointing to cloud.appwrite.io and appwrite.global configured as the function domain so that when a function is created, people get a url for their function automatically. However, if people want a custom one like mycustom.domain, they can add a custom function domain
Ok, but every function will need it's own A record right?
<function_id>.whateverdomain.com
No, CNAME if you want a custom one
Then how do I point the specific function to the domain
Tha'ts what I'm doing right now and it's not working
I have my appwrite main domain at appwrite.mydomain.com: A record to my server IP
if I create a CNAME to that domain on my function settings, it will be just a CNAME to that domain, the server has no clue which function it is
a cname is an alias
No, you create a wildcard one so that *.whateverdomain.com points to your main domain
oh, ok, but that wildcard is an A record
No CNAME
The point is to make it so you don't have to change multiple DNS records if your IP address needs to change
I've done that, created a CNAME wildcard *.fun.myotherdomain.com pointing to my appwrite.mydomain.com, but still error
Sure, that's what we want, to have everyting organized
Is this from a function from before you set the environment variable?