question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

apollo-server-micro not compatible?

See original GitHub issue

I use Nextjs 9 and happy to use apollo graphql run same project. but i problem to use graphql-upload in apollo-server-micro

I console.log request income

[ Promise {
    { filename: 'aa5.png',
    mimetype: 'image/png',
    encoding: '7bit',
    createReadStream: [Function: createReadStream] } } ]

when I upload in client to server i found error “createReadStream is not a function” 😦 please help.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

77reactions
ulentinicommented, Apr 19, 2021

In case someone else is stuck with this, I was able to solve it by using processRequest():

import { ApolloServer } from "apollo-server-micro"
import { processRequest } from "graphql-upload"

export const config = {
  api: {
    bodyParser: false,
  },
}

const apolloServer = new ApolloServer({
  // ...
})

const apolloHandler = apolloServer.createHandler({ path: "/api/graphql" })

export default async (req, res) => {
  const contentType = req.headers["content-type"]
  if (contentType && contentType.startsWith("multipart/form-data")) {
    req.filePayload = await processRequest(req, res)
  }
  return apolloHandler(req, res)
}
3reactions
mouhsinelonlycommented, Jan 17, 2021

@shipcake wondering the same what was the resolution for this, thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Choosing an Apollo Server package
Learn more about deprecation and end-of-life. Apollo Server is distributed as a collection of different packages for different environments and web frameworks.
Read more >
apollo-server-micro - npm
The `apollo-server-micro` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023).
Read more >
apollo-server-micro | Yarn - Package Manager
The apollo-server-micro package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality ...
Read more >
apollo-server-micro: response is missing header 'access ...
Not sure if you solved it already but I had the same issue. Even with the latest update in next.js examples docs it...
Read more >
Apollo & Prisma & Database | Next-Generation ORM for SQL ...
It's the easiest way to build a GraphQL API with Apollo Server and MySQL, ... It is compatible with Apollo's native SDL-first approach...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found