Hey guys, I tried to use the File API, but it isn’...
# prisma-whats-new
m
Hey guys, I tried to use the File API, but it isn’t working. I also noticed some restrictions about Schema written in documentation, but I am not completely sure what’s the meaning, because nothing works for me. Is there any example of File API-use which works, because the one listed in GitHub doesn’t? I would appreciate any idea, really, for what might be the solution! Thanks in advance! (also, so far: The client (fetch) reported connection reset error and then internal server error (500), is there any way to see server logs?)
t
Hey, I've just tried fetch (Javascript) example from the docs - works as expected, here is more info: https://docs-next.graph.cool/reference/api/file-management-eer4wiang0
m
Hey @taikn, I will try that as well! Thank you! Can you maybe send me the Schema of your File type?
t
Sure, here it is:
Copy code
type File {
  contentType: String!
  createdAt: DateTime!
  id: ID! @isUnique
  name: String!
  secret: String! @isUnique
  size: Int!
  updatedAt: DateTime!
  url: String! @isUnique
}
❤️ 1
m
Thank you so much! It works not, I figured out the problem was with @model next to the File type in my schema. Thank you so much!!
👍 2
n
hey @matic and @taikn, what did you do to endup with
@model
in the File type?
m
I was constructing the Schema on my own and because the SDL says that each Type with
@unique ID
field should have
@model
in order to be automatically added (that’s the way I interpreted it), I added it to
File
type, which resulted in not working File upload API. Maybe it would be helpful to note this in
Current limitations
section, next to the part about unsupported required types.
t
@nilan Also there was a discussion regarding
Node
interface here: https://graphcool.slack.com/archives/C0MQJ62NL/p1507186528000130?thread_ts=1507098030.000052&cid=C0MQJ62NL and
@model
seems to be the way of defining types