Graphcool / graphcool-framework

Apache License 2.0
1.77k stars 131 forks source link

File upload fails with status 500 and empty response when not all required fields defined #410

Open marktani opened 6 years ago

marktani commented 6 years ago

Issue by danistefanovic Saturday Nov 18, 2017 at 08:09 GMT Originally opened as https://github.com/graphcool/prisma/issues/1295


Current behavior If your "File" schema definition is missing some required fields, the file upload fails with a 500 error and an empty response body. (The documentation under Reference > GraphQL API > File Management is missing the "size" property.)

See also: https://www.graph.cool/forum/t/uploading-a-file-to-the-file-api/1628

Reproduction

type File @model {
  id: ID! @isUnique
  createdAt: DateTime!
  updatedAt: DateTime!
  contentType: String
  name: String
  secret: String @isUnique
  # size: Int
  url: String
}
  1. Open Chrome Dev Toos / Firebug
  2. Drag and drop a file to the Graphcool Console
  3. HTTP response -> 500, empty response body

The same procedure with all required fields in the schema definition: 200 and a JSON in the response body 👍

Expected behavior? The response body should contain further information about missing required fields.

marktani commented 6 years ago

Comment by marktani Saturday Nov 18, 2017 at 14:07 GMT


Thanks, just updated the docs to mention size.

marktani commented 6 years ago

Comment by kbrandwijk Saturday Nov 18, 2017 at 14:13 GMT


Might also need some additional server-side error handling, since that was all based on the assumption that you couldn't remove any system fields, so checking wasn't really necessary.