profile
viewpoint

Ask questions"API resolved without sending a response" false positive

Bug report

Describe the bug

next api route logs

API resolved without sending a response for /graphql, this may result in stalled requests.

even though it sends a response;

To Reproduce

Set up a route like:

// /api/graphql.ts
import { createProxyMiddleware } from 'http-proxy-middleware';

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

export default createProxyMiddleware({
  target: process.env.API_ENDPOINT,
  pathRewrite: { '^/api': '' }
});

And call it from the browser

Expected behavior

No unnecessary warning messages

System information

  • Version of Next.js: 9.2.2
zeit/next.js

Answer questions jamesmosier

Is this answer perhaps helpful? https://github.com/zeit/next.js/issues/10439#issuecomment-583214126

"[Next] can't detect you are still doing work in the API unless you return a promise and wait to resolve it until after the callback is fired"

useful!
source:https://uonfu.com/
Github User Rank List