Back

Unhandled Runtime ErrorAppwriteException: Network request failed

  • 0
  • Web
heyy_harshh
18 Aug, 2023, 06:14

when running in locahost:3000 got this error. Tech: Nextjs Hostname: localhost

TL;DR
Runtime error: AppwriteException: Network request failed
Drake
18 Aug, 2023, 19:03

What's your code? Can you try and give some more context?

heyy_harshh
20 Aug, 2023, 16:07

//appwrite.js file

heyy_harshh
20 Aug, 2023, 16:08

import {Client, Account, ID, Databases, Storage} from "appwrite"; const client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") .setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID!)

const account = new Account(client); const databases = new Databases(client); const storage = new Storage(client);

export {client, account, databases, storage, ID};

heyy_harshh
20 Aug, 2023, 16:09
Drake
21 Aug, 2023, 00:11

Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

Drake
21 Aug, 2023, 00:12

Can you try logging that environment variable before passing it into set project?

heyy_harshh
24 Aug, 2023, 12:10

I couldn't get the solution, so moved to different one! I will close this issues thanks

safwan
24 Aug, 2023, 12:15

process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID! The exclamation mark might be the issue

safwan
24 Aug, 2023, 12:18

it should work with the !, but it has always given me problems (idk why) that's why I just do as string

heyy_harshh
24 Aug, 2023, 12:18

It is necessary to use, in order to let the project know that yes, I know this will work

safwan
24 Aug, 2023, 12:31

Yes that's true. Regardless, you said you fixed it. Mind sharing how you did that

safwan
24 Aug, 2023, 12:31

So other people who face a similar issue can use your solution!

heyy_harshh
24 Aug, 2023, 12:33

Actually could solve it, and had to complete the project, so used mongoDB instead

heyy_harshh
24 Aug, 2023, 12:34

couldn't*

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