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

Increase deadline/timeout of the RPC call #174

Closed
thatsnoi opened this issue Sep 22, 2023 · 4 comments
Closed

Increase deadline/timeout of the RPC call #174

thatsnoi opened this issue Sep 22, 2023 · 4 comments

Comments

@thatsnoi
Copy link

Currently, I'm getting a 504 timeout error because the request takes too long. I haven't found any documentation on how to configure it.
Im using createGrpcWebTransport to init the transport but AFAIK it doens't have an option to set a timeout (related connectrpc/connect-es#799)
How do I increase the deadline/timeout of my RPC Call while using tanstack?

@thatsnoi
Copy link
Author

I see that I can set the timeout like this: createSomething.useMutation({ callOptions: { timeoutMs: 20000 } }) but this results in a CORS error:
Access to fetch at 'http://localhost:8080/api.v1....' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field grpc-timeout is not allowed by Access-Control-Allow-Headers in preflight response.

@timostamm
Copy link
Member

Hey Noah, I recommend to investigate what exactly is timing out first. A HTTP 504 response is not a typical response for a gRPC-web service. You can take a look at the response in the network inspector in the browser.

It seems most likely that the server or an intermediary is timing out, and responding with a HTTP 504 response, possibly with a HTML body with more details.

@timostamm
Copy link
Member

We are currently adding documentation for the timeoutMs option here.

Your backend currently does not allow browser clients to send the grpc-timeout header, hence the CORS error. It needs to be explicitly allowed, see here.

@thatsnoi
Copy link
Author

Thanks Timo! You were right, the issue was related to envoy proxy and not to the client :)

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

2 participants