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

Streams error in deno_web #495

Open
juliangruber opened this issue Feb 25, 2024 · 4 comments
Open

Streams error in deno_web #495

juliangruber opened this issue Feb 25, 2024 · 4 comments

Comments

@juliangruber
Copy link
Member

error: Uncaught (in promise) Error: request or response body error: error reading a body from connection: unexpected end of file
    at async Object.pull (ext:deno_web/06_streams.js:942:27)

Unfortunately the stack trace doesn't contain more information. Do you happen to know more about this error?

@bajtos
Copy link
Member

bajtos commented Feb 27, 2024

When Lassie discovers a verification problem after it already started streaming the CAR response body, it needs to let the client know about the problem. The current solution is to abort the stream in a way that breaks the HTTP/1.1 protocol.

The error message seems to describe this error condition.

error reading a body from connection: unexpected end of file

I see two ways forward:

  1. Detect this particular error and handle it differently
  2. Retrieve CIDs directly using fetch spark#46

@bajtos
Copy link
Member

bajtos commented Feb 27, 2024

Detect this particular error and handle it differently

As part of Zinnia-Lassie integration, we can detect this error condition and wrap or annotate the error instance with a code that will make it easier for Station modules to detect this particular error.

Either way, we need to modify Spark Checker node to detect & handle this error in a special way.

I propose introducing a new "retrieval result" value - "verification failed". IIRC, we don't have any existing "measurement" field to accommodate this new flag/status. We need to think a bit more about this.

@juliangruber
Copy link
Member Author

Do you know how we can catch this error?

I agree that if we continue using Lassie, wrapping this error message is the way to go, to give the user more useful context.

This is also happening with Voyager btw (and this particular error message is from Voyager), which doesn't use Zinnia's Lassie integration

@bajtos
Copy link
Member

bajtos commented Feb 29, 2024

Do you know how we can catch this error?

I would expect something like this to work:

try {
  await fetch(/*...*/);
} catch (err) {
  if (err.message === 'request or response body error: error reading a body from connection: unexpected end of file') {
    // this error was triggered
  } else {
    throw err;
  }
}

This is also happening with Voyager btw (and this particular error message is from Voyager), which doesn't use Zinnia's Lassie integration

Interesting! Doesn't Saturn L1 use Lassie under the hood to retrieve the content from the upstream provider?

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