Skip to content
Back

[AppwriteExeption: Network request failed.]

  • 0
  • Cloud
zombikaa
19 Apr, 2025, 13:26

Hi! I always get AppwriteExeption: Network request failed, to this code:

TypeScript
  console.log(file.uri)
  try {
    const response = await storage.createFile(
      appwriteConfig.pfpBucketID,
      ID.unique(),
      {
        name: `${username}_pfp`,
        type: "image",
        size: file.fileSize,
        uri: file.uri,
      }
    );

    return response.$id;
  } catch (error) {
    console.error("Error:", error);
  }
};

This worked before, now it doesnt. Is this related to the endpoint problem? #Internal error (500) on custom domain

TL;DR
Developers experiencing 'AppwriteException: Network request failed' are advised to check custom domain endpoints and ensure correct configuration. Using the Cloud console is recommended, as custom domains should be reserved for API/Functions. Ensure the URL in Project > Settings is correct and verify that the custom domain points to the new region-based API endpoint on Cloud. To troubleshoot, log the endpoint URL before the 'createFile' function to validate its correctness. The issue in the provided code snippet may be related to the endpoint problem.
Darshan Pandya
19 Apr, 2025, 13:28

Can you print the endpoint url right before createFile?

Darshan Pandya
19 Apr, 2025, 13:28

something like this should help - console.log(client.config.endpoint);

zombikaa
19 Apr, 2025, 13:29

the endpoint is a custom url

Darshan Pandya
19 Apr, 2025, 13:30

is it printed correct? should be -

TypeScript
https://<CUSTOM_URL>/v1
Darshan Pandya
19 Apr, 2025, 13:30

also verify that your custom domain points to the new region based api endpoint on Cloud.

Darshan Pandya
19 Apr, 2025, 13:30

You can check the url in your Project > Settings.

zombikaa
19 Apr, 2025, 13:31

yes, and i configured it correctly

Darshan Pandya
19 Apr, 2025, 13:32

hmm, using the default or the new region domain for cnamed domain should work. do you have any more logs, or info. that you can share? A Network request failed doesn't give much info. except that the host might not be reachable or something's wrong with the url.

zombikaa
19 Apr, 2025, 13:34

i set the cname correctly, like the region, i can enter the console from the custom domain, but on every page it says 500 internal error

Darshan Pandya
19 Apr, 2025, 13:35

Its sort of expected, you should use the Cloud console. Custom domain side console access has its own security considerations. This is going to be soon fixed where console should be only used via cloud console. Custom domains are meant to be used for API/Functions, atleast that was the historical intention. With multi-region, its been something we've thinking to fix soon!

zombikaa
19 Apr, 2025, 13:37

alright thanks, but i if i use the cloud endpoint, i have to change my functions endpoints too, so there is no point having custom domain (?)

Darshan Pandya
19 Apr, 2025, 13:38

You are fine to use the custom domains endpoints for functions and sdks. If you have more info. on the network request failed, feel free to add here and we should be able to help.

Darshan Pandya
19 Apr, 2025, 13:39

You can also DM if the credentials cannot be shared publicly.

zombikaa
19 Apr, 2025, 13:54

alright, if i find out something, ill let you know

zombikaa
19 Apr, 2025, 13:54

thanks

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