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

Throw error if a shape response doesn't include necessary headers #1950

Closed
KyleAMathews opened this issue Nov 6, 2024 · 4 comments · Fixed by #1957
Closed

Throw error if a shape response doesn't include necessary headers #1950

KyleAMathews opened this issue Nov 6, 2024 · 4 comments · Fixed by #1957
Assignees

Comments

@KyleAMathews
Copy link
Contributor

Two people on discord today reported they hit an infinite loop where a shape request with offset=-1 came back with a 200 status but was missing the electric-offset header.

Both had proxies that for one reason or another had stripped the header(s).

Electric doesn't work without its headers so we should give a more helpful clue to people writing middleware on what is wrong.

The error message should look something like:

The response for the shape request to ${url} didn't include the following required headers:
- electric-offset
- etc

This is often due to a proxy not allowing all headers to be returned. See this doc page for more information: https://electric-url.com/something
@thruflo
Copy link
Contributor

thruflo commented Nov 6, 2024

That link at the end of the error message could go to a section on this in the troubleshooting guide.

@KyleAMathews
Copy link
Contributor Author

Yeah that'd be perfect

@KyleAMathews
Copy link
Contributor Author

KyleAMathews commented Nov 7, 2024

Perhaps even simpler is we just check that we never make a request to the same URL twice. As that covers a lot of potential problems.

@thruflo
Copy link
Contributor

thruflo commented Nov 7, 2024

Yup, avoiding the scenarios where we hammer the sever with requests in a loop would be good.

There are cases where we do want to call the same URL more than once — eg when trying to sync a table that doesn’t exist yet, we get an error response and keep trying the same URL until the table is created. So there we maybe want more of a backoff.

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

Successfully merging a pull request may close this issue.

3 participants