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

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

Open
4 tasks
rxwang662001 opened this issue Oct 24, 2024 · 6 comments

Comments

@rxwang662001
Copy link

rxwang662001 commented Oct 24, 2024

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.

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

Describe the bug
for some graphql query from browser url like server:port/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:

  • OS:
  • @graphql-mesh/...:
  • NodeJS:
    -import { createServer } from 'node:http';
    import { createMeshHTTPHandler } from '@graphql-mesh/http';
    const meshHTTPHandler = createMeshHTTPHandler({
    baseDir,
    }
    const server = createServer(meshHTTPHandler);

Additional context

@ardatan
Copy link
Owner

ardatan commented Nov 6, 2024

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
Copy link

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

@ardatan
Copy link
Owner

ardatan commented Nov 7, 2024

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
Copy link

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)

@rxwang662001
Copy link
Author

rxwang662001 commented Jan 8, 2025

@ardatan
Appreciate your feedback!
right now we're using below lib, as you said this issue maybe fixed through some lib, please suggest how to update below lib,
thanks very much!
"@graphql-mesh/cli": "^0.88.0",
"@graphql-mesh/graphql": "^0.96.0",
"@graphql-mesh/json-schema": "^0.96.0",
"@graphql-mesh/openapi": "^0.96.0",
"@graphql-mesh/runtime": "^0.97.0",
"@graphql-mesh/transform-encapsulate": "^0.96.0",
"@graphql-mesh/transform-extend": "^0.96.0",
"@graphql-mesh/transform-filter-schema": "^0.96.0",
"@graphql-mesh/transform-hoist-field": "^0.96.0",
"@graphql-mesh/transform-prefix": "^0.96.0",
"@graphql-mesh/transform-rename": "^0.96.0",
"@graphql-mesh/transform-replace-field": "^0.96.0",
"@graphql-mesh/transform-resolvers-composition": "^0.96.1",
"@graphql-mesh/transform-type-merging": "^0.96.0",

checked changelog, your commit looks go to
@graphql-mesh/[email protected]
and
@graphql-mesh/[email protected]

please confirm, thanks!

@ardatan
Copy link
Owner

ardatan commented Jan 8, 2025

@rxwang662001 Similar to what I said above, you can just update the versions you have in package.json, and try again.

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

3 participants