ardatan / graphql-mesh

🕸️ GraphQL Federation Framework for any API services such as REST, OpenAPI, Swagger, SOAP, gRPC and more...
https://the-guild.dev/graphql/mesh
MIT License
3.29k stars 345 forks source link

graphql query hang from browser and return error 504 Gateway Time-out after 18 minutes or so #7823

Open rxwang662001 opened 2 weeks ago

rxwang662001 commented 2 weeks ago

Issue workflow progress

Progress of the issue based on the Contributor Workflow

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

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


Describe the bug for some graphql query from browser url like /graphql?query=query+MyQuery sometimes the query shall hang about 18 minutes also and received an error "504 Gateway Time-out" if checking the graphql server log i could see actually the query has already got the feedback in 10 minutes from its configured source handler. from the graphql server log i could see query results like below: => Received { ... Returning { .... Adding response metadata to the response object .... but the browser never get any response until timeout. i searched this repo and see above log is from packages/transports/rest/src/directives/httpOperation.ts operationLogger.debug(Adding response metadata to the response object); return Array.isArray(responseJson) ? responseJson.map(obj => addResponseMetadata(obj)) : addResponseMetadata(responseJson); };

i doubt there maybe issue happened during addResponseMetadata in here. but since from the log there is no any error showing, so not sure how to debug it. Any advice for such issue? thanks.

To Reproduce Steps to reproduce the behavior:

Expected behavior

Environment:

Additional context

ardatan commented 6 days ago

We got some reports like hanging requests on Node 20. And we found that node-libcurl package we use was causing that. And we have removed it in Mesh v0. Could you update it and try again?

emmanuelnk commented 5 days ago

@ardatan Can you provide more context into the node-libcurl and node v20 issue?

ardatan commented 5 days ago

We were using node-libcurl as a HTTP Client. And we got some issues reported from our users that Mesh sometimes hangs on requests to the upstream services on Node 20. Then we removed it, and the issues have been solved.

emmanuelnk commented 5 days ago

okay great because we've also been observing this hanging behaviour (we are also on node v20 currently and @graphql-mesh/runtime v0.98 and @graphql-mesh/cli v0.89 -- will update and hopefully this addresses our CPU issues we've been seeing lately (and probably also close #7852 which I opened recently)