Back

Bad gateway when i create file

  • 1
  • Storage
  • Cloud
otik
22 Jun, 2023, 17:59

Hi i am geting and error 502 (bad gateway) when i create file from my node.js server (from client it works) I am using cloud. Cloud someone help me please?

here is code for creating: await storage.createFile(".........", "...........", InputFile.fromBuffer(myBufferString, "constant file name"))

Can i have one constant name for all files? I dont really want to name my files.

TL;DR
User is encountering a 502 (bad gateway) error when attempting to create a file from their Node.js server. The error does not occur when creating files from the client. They are using a cloud storage service. One potential solution is to check if the mime type parameter or the file name on the input file are missing, as this could be causing the error. User also asks if it is possible to create files with a consistent name, as they do not want to name the files individually. The user later realizes that the mistake causing the error is not related to file creation, and apologizes for the interruption. TL;DR: User
Drake
22 Jun, 2023, 18:28

where is your server code running and what's the endpoint set to?

otik
22 Jun, 2023, 18:32

my server code is in node.js, is running in my node.js server

otik
22 Jun, 2023, 18:33

endpoint is set to: https://cloud.appwrite.io/v1

Drake
22 Jun, 2023, 19:05

interesting...that should work fine...do other API calls work fine in your node server?

otik
22 Jun, 2023, 19:06

yes it does, for example documents work properly

Drake
22 Jun, 2023, 19:09

weird...what's your project ID?

otik
22 Jun, 2023, 19:10

my project ID is: "Quizi"

Drake
22 Jun, 2023, 19:11

hmm i don't see anything for that project...

Drake
22 Jun, 2023, 19:11

can you try to print the endpoint before the createFile call?

otik
22 Jun, 2023, 19:22
otik
22 Jun, 2023, 19:22

i dont know why is it in updateFile, when i am creating it

otik
22 Jun, 2023, 19:25

and i have to have original name for every file?

otik
22 Jun, 2023, 19:38

I am very sorry, mistake is somewhere else. Sorry for interupting

Drake
22 Jun, 2023, 20:42

So you're all good now?

otik
22 Jun, 2023, 21:13

Yes, i am all good. Thank you very much

otik
22 Jun, 2023, 21:15

Maybe only one question. When i create the file, it creates plain/text (inside is base64), but i would like to create .png, is there any way to do it?

Drake
22 Jun, 2023, 21:18

It could be due to the missing mime type parameter or the file name on input file

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