Is anybody using `apollo-upload-client` with `grap...
# prisma-whats-new
m
Is anybody using
apollo-upload-client
with
graphql-yoga
?
n
Yes. 🙂
m
Do you have an example? I feel like I’m close but can’t quite figure it out.
m
Are you trying to connect the Apollo upload client to your server?
n
side comment: it's almost always better to ask the real question right away, and skip the "does anyone" part 🙂 on your question: @martin looked into this recently, I'm sure he can help you out.
👍 1
m
Yes @martin. I’ll keep that in mind for next time @nilan. My first question would be how I can have both an httplink with auth and an upload link in the apollo client @martin? I can message you directly if you prefer.
n
there should already be an example, can you share that here @martin?
m
I’m currently getting
Cannot return null for non-nullable field Mutation.uploadFile.
but I’m able to send the file to the server (in a convoluted way).
m
I’m on my phone atm on the subway, so it’s kinda hard for me to read code on this small screen. But I did this for a couple of hours ago: https://github.com/Martinnord/Ecommerce-app/blob/master/src/index.js
😄 1
So yea, you can both have httplink and Auth! 😄
m
Awesome 🙂 I’ll take a look and let you know!
m
Cool dude. I’ll be on my computer in 20 mins. If the problem still remains, we can chat more detailed then
l
Tagging in for updates 🙂
👀 2
m
@manticarodrigo by the way, are you being able to store your files in a directory somewhere?
m
I’m using a module that uploads the files to fake s3 on a local docker container. I had it working already from client side with fetch but I want to process everything through graphql on server if possible
Your server-side implementation would be nice to see 😄
The authLink with upload is working 😄
m
Cool to hear that it’s working! Yeah sure I have it on GitHub. Some files are worth looking at. I’ll leave the link here for know so you can check it out yourself. I’m home soon
m
Awesome! Thanks again
So I’m able to get the file on the server with it’s stream, filename, mimetype, and encoding. Now I need it converted into a format for Prisma with a name, secret, size, body, and contentType to upload on S3 client. Any ideas on how to accomplish this?
n
Prisma doesn't have a built-in concept for File handling.
I assume you are referring to https://github.com/graphcool/prisma/tree/master/examples/file-handling-s3? This is only an example, nothing set in stone.
m
Thanks @nilan. I’m trying to write my own implementation but can’t figure out what time of file object I’m getting on server side.
Does anybody know what this is :
Copy code
{ stream: 
   FileStream {
     _readableState: 
      ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: [BufferList],
        length: 65023,
        pipes: null,
        pipesCount: 0,
        flowing: null,
        ended: false,
        endEmitted: false,
        reading: false,
        sync: true,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        destroyed: false,
        defaultEncoding: ‘utf8’,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events: { end: [Array], limit: [Function] },
     _eventsCount: 2,
     _maxListeners: undefined,
     truncated: false,
     _read: [Function] },
  filename: ‘edumate.png’,
  mimetype: ‘image/png’,
  encoding: ‘7bit’ }
n
Would you mind describing your situation in a new thread here: https://www.graph.cool/forum/c/questions? 🙂
l
That's a node stream
m
Thanks @lawjolla . Sorry for the spam @nilan. I’ve almost figured it out. If anyone is interested in a apollo-upload-server/client implementation of file handling for s3 let me know. I’m almost there.
💯 1
n
awesome! 😄
Looks like we should improve our example, or add a new one as well. Curious to see what you end up with then! 🙂
l
I'm working on an image resizer today. (Image upload -> resizes -> S3 (DO Spaces, actually 🙂 ) -> Prisma with the meta data)
👀 1
m
Everyone is so hardcore 😮
🚀 1