Showing results for 
Search instead for 
Did you mean: 
Surveyor II

GraphQL 504

This is some feedback on the GraphQL API for anyone who cares to read it.

We love how fast GraphQL is, and how easy it is to use. We went all in and converted about a dozen of our requests to GraphQL. However, they often return a 504 error like the one in the attached image. So we had to remove them all except the submissions node. It appears to be the only one that is stable enough for production use.

I hope the feedback helps. As far as I can tell, this is a problem on the Canvas side and has nothing to do with our code, but, if I am wrong, I'd love to know.


Tags (1)
0 Kudos
1 Reply


I haven't started using GraphQL in my queries yet, although it has been tempting to get faster responses (the lack of SIS support is one blocker for me).

I get that error when I try a request that times out. This happens on a course with 331 enrollments for me. It works for a course with 44 enrollments.

It sounds like Canvas is operating correctly but you're not handling pagination. With the regular API, it let you know there was extra pages in the links header. For GraphQL, it times out and you get the 504 gateway error if it cannot deliver the entire thing with one request and you do not specify pagination.

In short, you still have to handle pagination with GraphQL requests but now you have to handle it yourself rather than having to deal with the default per_page=10 and an upper limit of per_page=100.

I'm not sure what you're trying to accomplish, but unless you are trying to determine if a student in a course is ever anything but a student in any of their other courses, then this is probably not be returning what you want. It is not returning the enrollment type for the student in all courses, not specific to that course.

For my first student, it include 11 enrollment types (all StudentEnrollment). 11 is the total number of enrollments that student has in our Canvas instance. Another student had 40-some (I lost track) enrollments, again, all StudentEnrollment.

If you want just their enrollment in that particular course, then you can change enrollments to enrollments(courseId: 500310). That is much faster since it is only returning the enrollment for one course.

When I do that, that request that failed with 331 enrollments comes back in a couple of seconds.