nicetomytyuk
nicetomytyuk8mo ago

How to resolve: http2 error: stream error detected: unspecific protocol error detected?

When I try to make a POST request using fetch in DENO I get the error mentioned in the title. The code: async activate(company: Company): Promise<void> { await fetch('http://xxx.it/db/activate', { body: JSON.stringify(company), method: 'POST', }); }
4 Replies
Deno AI Helper
Deno AI Helper8mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the code snippet you've provided, there are no obvious syntax errors or mistakes. It's important to note that the error message you're encountering, "http2 error: stream error detected: unspecific protocol error detected," suggests there might be an issue with the HTTP/2 communication, which could be related to the server configuration or the way the request is being made. One thing to consider is ensuring that the server you're trying to communicate with supports HTTP/2 and that there are no compatibility issues. Additionally, you might want to check if the server expects certain headers or if there's a need to handle the response in a specific way. Since this advice is not based on the Deno documentation, please double-check the accuracy of the advice given and consider looking into server-side logs or configurations that might shed more light on the issue. If the problem persists, you may want to reach out to the community or the maintainers of the server you're trying to interact with for more specific guidance.
nicetomytyuk
nicetomytyukOP8mo ago
If the same API is called from Postman It returns the correct response, else If I run it from DENO in development or deployed I do get that http2 error. I've made another text by calling another server, and the request was successful, the issue at that point is for sure on the server side I am calling, it does not support HTTP2, so is there a way to run that DENO function with HTTP1 support?
CatalinIuga
CatalinIuga8mo ago
The only useful thing I found was this discussions: https://github.com/denoland/deno/discussions/14851 Beside trying to switch to http:... insted of https:... , you could techically use a TCP connection to make requests. More effort than using fetch since you have to construct the HTTP requests yourself, but it could work. Here's docs about TCP connections: https://docs.deno.com/deploy/api/runtime-sockets
GitHub
How to disable HTTP/2 in fetch? · denoland deno · Discussion #148...
Is there a way to disable HTTP/2 for fetch calls? I have an upstream dependency with a possibly broken HTTP/2 implementation, and it is randomly returning INTERNAL_ERROR HTTP/2 error code. I figure...
TCP sockets and TLS | Deno Docs
Deno Deploy supports outbound TCP and TLS connections. These APIs allow you to
nicetomytyuk
nicetomytyukOP8mo ago
At the end I've move those request to the web application, less reusable solution but it has to resolve only a temporary issue with an old server, btw thank you for the tips 🤝🏻

Did you find this page helpful?