0

I have two graphql subgraphs server a and server b. Each running fastify and mercurius and using grapqql-upload to handle files. I also have an apollo gateway connected to both servers and working well for queries and mutations. However when using file upload I get a validation error. Anyone ever dealt with this ? Do I need to process the uploaded file in both the gateway and the subgraphs

I have tried processing the file on both the gateway and the subgraph as well as only on the subgraph and on only on the gateway using

app.addHook("preValidation", async (req, res) => {
    if (
      !req.headers?.["content-type"]?.includes("multipart") ||
      req.url !== "/graphql"
    ) {
      return;
    }
    const body = await processRequest(req.raw, res.raw);
    console.log(body);
    req.body = body;
  });

however i'm still unable to upload files i run into graphql validation error

4
  • What's the error? Commented Aug 17, 2023 at 15:10
  • Graphql Validation failed Commented Aug 18, 2023 at 10:39
  • @Cyrillekeith any update on this fileupload issue with apollo/gateway?
    – amit
    Commented May 29 at 2:29
  • @amit I ended up creating a rest endpoint to handle the file uploads and use the file link in graphql instead of directly uploading the file through graphql Commented May 29 at 6:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.