Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run cli 0.83.x on a Mac - Error: Returning from a request handler without responding or attaching an abort handler is forbidden! #5562

Closed
2 of 4 tasks
mlasevich opened this issue Jun 14, 2023 · 7 comments

Comments

@mlasevich
Copy link

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on
    below

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

When running cli with mesh dev on a Mac 13.4 with @graphql-mesh/cli version 0.83.1 or newer the following error is seen:

💡 🕸️  Mesh - Server Starting GraphQL Mesh...
💡 🕸️  Mesh - Stripe Generating GraphQL schema from OpenAPI schema
Error: Returning from a request handler without responding or attaching an abort handler is forbidden!
libc++abi: terminating
Abort trap: 6

if version of cli is downgraded 0.82.35 - it works fine

When tested in a linux container, it appears to also work fine - perhaps related to the code that is opening the browser?

To Reproduce Steps to reproduce the behavior:

Using the following config, run npm install; npm run dev

package.json

{
  "name": "graphql-mesh-messing-around",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "mesh dev"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@graphql-mesh/cli": "0.83.1",
    "@graphql-mesh/openapi": "^0.94.2",
    "@graphql-mesh/runtime": "^0.94.0",
    "graphql": "^16.6.0"
  }
}

.meshrc.yml

sources:
  - name: Stripe
    handler:
      openapi:
        source: https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json
        endpoint: https://api.stripe.com

Environment:

  • OS: macOs 13.4
  • versions - see package.json
  • NodeJS: attempted with 18 and 16

Additional context

N/A

@ardatan
Copy link
Owner

ardatan commented Jun 14, 2023

Please create a reproduction on CodeSandbox.

@mlasevich
Copy link
Author

Don't think that is possible, I do not see any option on CodeSandbox to run MacOS

@Alutery
Copy link

Alutery commented Jun 27, 2023

Maybe it's related to the new dependency:
uNetworking/uWebSockets.js#918

@nickaguilarh
Copy link

nickaguilarh commented Jun 29, 2023

Hi there. I'm having the same issue and manage to make it work. I was looking for a reason why this is happening and found that every request handler MUST end send a response. Debugging the project, I manage to make it work by adding an else condition for when (I think) the server is not ready yet. This is not a solution, but a starting point for someone that knows a lot more about the library (I'm just starting using it).

https://github.com/Urigo/graphql-mesh/blob/30ecdbde782acf9b33e35805bc0f7deacbf4b038/packages/http/src/index.ts#L96-L118

After that, add an else condition that sends a response. What I'm doing at the moment is add this:

else {
  endResponse( 
     new Response(null, { 
        status: 503,
        statusText: 'Service Unavailable',
     }), 
    ); 
}

That way, the server continues execution and if I refresh the page after a couple of seconds, everything works as intended. I guess we could wait until the server is ready somehow, so this else condition wouldn't be required, or something else. But since I don't know enough of the codebase, I can't write a PR to fix this as it should be. I hope this helps anyone to fix this error.

BTW, this happens only if I run mesh dev, if I build and start this doesn't happen.

EDIT1: Maybe it is due that the browser is making a request too early. Maybe delay the browser start or leave it to the user to open the URL from the command line. If you can suggest me where this is set up, I could test it.

Greetings,

@Marx2
Copy link

Marx2 commented Jul 17, 2023

I have the same problem. What is last working version of dependencies?

@ardatan
Copy link
Owner

ardatan commented Jul 17, 2023

@whatwg-node/server@0.9.4 should fix the issue. Could you update your lock file and try again? Thanks!

@ThomasMoritz
Copy link

@whatwg-node/server@0.9.4 should fix the issue. Could you update your lock file and try again? Thanks!

Perfect! Thx a lot. That helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants