-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(gateway): handle streaming errors, IPIP 332 #9333
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we did not include them here on purpose – because of this bug in Nodejs: nodejs/undici#432 (comment)
Better late than never, Node folks realized the mess, and it seems to be resolved now (nodejs/undici#1418), but older versions like Node 18.0.0 or Node 16.14.2 with Undici 5.1.1 will be impacted. Probably better for us to play safe here.
@hacdias are you able to identify Node versions with the fix?
Did the Undici fix landed in LTS?
ps. Trailers are not supported by browsers, the docs you've linked are invalid: mdn/browser-compat-data#14703 🙈
There are too many issues with Trailers: for these reasons, we did not include it the gateway specs at all. It is up to the client to verify the received CAR stream anyway, so client has means of detecting errors and retry if any blocks from the requested DAG are missing. We could merge this in Kubo tho, as long it does not cause issues with Nodejs used in the wild.
@lidel no, this fix does not check for Node.js versions. I also want to notice that by not setting the |
883d29e
to
eba7ccd
Compare
So.. this header only impacts non-browser contexts and my understanding is that no matter what we do here it is always breaking something: If we have to choose between (A) not showing a header in curl (cosmetic), and (B) making it impossible to read valid responses with NodeJS version ranges using undici library with nodejs/undici#432 (comment) bug, I'd rather not break Nodejs clients, as we would have to triage these avoidable bugs 🙈 Spec-wise, I am against this header in undocumented formiiuc JS in Browser can't access these headers anyway – we need to double-check what is the value here: is it worth leaking RPC conventions into Gateway if it brings no value to Web use, and causes issues outside of it? Next stepsI suggest we fully remove these undocumented Trailer headers from the gateway use, and only introduce error-handling that works in web browser (e.g. force-close the connection?) If we feel there is value or functional here, we should create a spec IPIP that clarifies error handling on gateways, and not ship undocumented stuff. |
5f0d172
to
f0ccced
Compare
@lidel I opened an IPIP here: ipfs/specs#332 I think it's important to be clear on how to handle this situations. I don't expect them to happen frequently, but it's still important to be aware of them. We can discuss if must vs. should and/or recommended vs. required. |
I'll review once the spec is merged. But I think a header to optout of this behaviour might be nice. This has a real performance cost and will require clients to reopen a new connection (since we don't support HTTP2 there due to the lack of TLS cert). |
1acfd14
to
978648d
Compare
978648d
to
94f0399
Compare
25ce929
to
6d91d89
Compare
Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
6d91d89
to
f0d76b5
Compare
Closing due to reasons explained in ipfs/specs#332 (review) |
While working on #9029, I noticed the
Trailer
HTTP header was missing on CAR responses. If there was an error, the client would likely miss it.curl
, for example, would not show the trailing header on the output.Docs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer
Update: see #9333 (comment)