Back

[SOLVED] What might be causing a generic server error?

  • 0
  • Self Hosted
  • Flutter
mauricev
18 Feb, 2023, 04:25

I have a loop appending futures of create document and then waiting until they all complete. The first one always completes. For the 2nd through 4th, I may get one or two, but never all three. I get a generic server error 500. Here is my code

TypeScript
Future<List<dynamic>> SaveFacility() async {
    Map<String, dynamic> ourData = {
      'facility_name': facilityName,
      'facility_building': facilityBuilding,
      'facility_room': facilityRoom,
      'grid_height': gridHeight,
      'grid_width': gridWidth,
    };
    List<Future> theFutureList = [];
    theFutureList.add(
        _manageSession.createDocument(ourData, "63eefc630814627ea850"));
    for (int theIndex = 0; theIndex < rackList.length; theIndex++) {
      Map<String, dynamic> theRackMap = {
        'relative_position': rackList[theIndex].relativePosition,
        'absolute_position': rackList[theIndex].absolutePosition,
        'facility_name': facilityName,
      };
      theFutureList.add(
          _manageSession.createDocument(theRackMap, "63ef152596e8de3a0033"));
    }
    return Future.wait(theFutureList);
  }
TL;DR
User is experiencing a generic server error 500 when running a code that saves facility data in a loop. User suspects that there might be a limit to how quickly commands can be sent to the server. User has enclosed the `futurelist.add` inside a `future delayed` command and it seems to have solved the issue. Solution: Enclose the `futurelist.add` inside a `future delayed` command.
mauricev
18 Feb, 2023, 05:02

I think I got this working. I enclosed the futurelist.add inside a future delayed command. If this is indeed the case, it implies there is some limit to how quickly one can send commands to the server. If that is the case, the error should be more informative.

Drake
18 Feb, 2023, 06:03

When you get a 500 error, you'll have to check the docker logs for the appwrite container to see the underlying error

mauricev
18 Feb, 2023, 06:11

You mean the docker.log on the host or are there specific docker logs for each container, also on the host or contained within the container itself?

Drake
18 Feb, 2023, 06:27

There are logs for each container. I was referring to the logs for the appwrite container

mauricev
19 Feb, 2023, 05:05

Which container would be the one returning this error? There are more than a dozen.

Drake
19 Feb, 2023, 05:18

appwrite

Drake
23 Feb, 2023, 21:06

[SOLVED] What might be causing a generic server error?

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