Issue: Avatar URLs are using server IP address instead of configured domain Environment:
Appwrite Version: 1.8.0 Setup: Self-hosted on Google Compute Engine with Cloudflare Tunnel Domain: <your-domain> Frontend: Firebase Hosting at <your-frontend-domain>
Problem: The avatars.getInitials() endpoint is generating URLs with the server's IP address instead of the configured domain:
Current (wrong): http://<public-ip>/v1/avatars/initials?name=User&project=<project-id> Expected: https://<your-domain>/v1/avatars/initials?name=User&project=<project-id>
This causes:
ERR_CERT_AUTHORITY_INVALID errors (IP has no SSL cert) Mixed content warnings (HTTP images on HTTPS page) Blocked image requests
Configuration: All environment variables are correctly set in both .env and docker-compose.yml: bash_APP_DOMAIN=<your-domain> _APP_DOMAIN_TARGET=<your-domain> _APP_DOMAIN_FUNCTIONS=<your-domain> _APP_ENDPOINT=https://<your-domain>/v1 Verified: bashdocker exec -it appwrite printenv | grep APP_DOMAIN
Shows all domain variables are correct
Steps Taken:
Restarted Appwrite multiple times Cleared browser cache Added platform for frontend domain in Appwrite console Verified Cloudflare Tunnel is working correctly (other API endpoints work fine)
Question: Why is the avatar service still generating URLs with the IP address? Is there a cached value in the database or a specific configuration for the avatar service we're missing?
I been in the issue from yesterday
My appwrite is self hsoted in gcp and I have used cloudfalre tunnel for it.Console is opening from my subdomain adn data are allso being fetch from db.But avatar are not showing
You're passing an IP address into client.setEndpoint()
Get initials doesn't make any api call. It just builds the url and returns it. See https://github.com/appwrite/sdk-for-web/blob/de72141ece55b1eb4e8d14b8bf429c3b8bf690ce/src/services/avatars.ts#L461
No,I am not passing .I am passing subdomain url.import { Client, Account, Databases, Storage, Avatars } from 'appwrite'
export const appwriteConfig = { projectId: import.meta.env.VITE_APPWRITE_PROJECT_ID, url: import.meta.env.VITE_APPWRITE_URL, databaseId: import.meta.env.VITE_APPWRITE_DATABASE_ID, storageId: import.meta.env.VITE_APPWRITE_STORAGE_ID, userCollectionId: import.meta.env.VITE_APPWRITE_USERS_COLLECTION_ID, postCollectionId: import.meta.env.VITE_APPWRITE_POSTS_COLLECTION_ID, savesCollectionId: import.meta.env.VITE_APPWRITE_SAVES_COLLECTION_ID, commentsCollectionId: import.meta.env.VITE_APPWRITE_COMMENTS_COLLECTION_ID, followCollectionId: import.meta.env.VITE_APPWRITE_FOLLOW_COLLECTION_ID }
export const client = new Client(); client.setProject(appwriteConfig.projectId) client.setEndpoint(appwriteConfig.url)
export const account = new Account(client); export const databases = new Databases(client); export const storage = new Storage(client); export const avatars = new Avatars(client);
environment variable is set and I have rebuild and deplyed too by clearing cache.Everyone is requesting in subdomainurl but while fetching avatar url,it using http:<my public ip>
Before you call avatars.getInitials() can you log avatars.client.config?
And can you confirm which Appwrite SDK you're using and what version?
I need some time
GET https://<my_vm public_ip>/v1/avatars/initials?name=Testproduser&project=6928397b00217571c01f net::ERR_CERT_AUTHORITY_INVALID
"appwrite": "^17.0.2" in package.json
Appwrite Version: 1.8.0 in self hosting
Weird...this doesn't make sense...
Also, your SDK version is really old
exactly..I been debugging from yesterday
Would you please share your code here?
Even in this old version, the url is generated using the client.config.endpoint
I have share something to look into in your personal chat too
Maybe the issue is in my backend..I am using cloudflare tunnel for ssl certification and https but since the backend send the url of ip?i dont know
No like I said twice, there is no backend involved
Please share your code
Oh now I know..this was stupid mistake..lol Actually,I used my ip for storing user record previously and now after setting subdomain,the previous image url are not going to change from db.
I will fix that..thank you
Recommended threads
- Export, Import or Migration giving this ...
As you can see in yhe screenshot i am not able to export any data or export the data from tables. Also it is affecting the migration from appwrite to appwrite h...
- Project auto-blocked after load testing ...
Hi team 👋 My project has been automatically blocked with the message: "Project is currently blocked — Access to this project is restricted. Contact support if...
- App build crashing with "Internal error"
Hello Appwrite team! 👋 We are trying to deploy a Next.js application on Appwrite Cloud, but our builds are consistently failing. The deployment log successful...