Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: improve wsproxy error when proxyurl is set to a primary#11586

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 4 commits intomainfromstevenmasley/wsproxy_no_json_error
Jan 12, 2024

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedJan 11, 2024
edited
Loading

fixes:#11116

Screenshot from 2024-01-11 16-51-38

Check header for proxy instance, and check content-type for non json. If it's not a json payload, the json error is almost completely useless.

I think this could be formatted better, but it has the helpful information, which is enough for now imo.

@EmyrkGraphite App
Copy link
MemberAuthor

Emyrk commentedJan 11, 2024
edited
Loading

In this stack:🐛 Fix wsproxy error with primary proxyurl(?)

This stack of pull requests is managed by Graphite.Learn more about stacking.

Join@Emyrk and the rest of your teammates onGraphiteGraphite

Base automatically changed fromstevenmasley/wsproxy_errors tomainJanuary 11, 2024 22:55
@EmyrkEmyrkforce-pushed thestevenmasley/wsproxy_no_json_error branch from7c82247 to9656c7aCompareJanuary 11, 2024 22:57
Comment on lines 279 to 307
isCoderErr := fmt.Errorf("proxy url %q is not a coder proxy instance, verify the url is correct", reqURL)
if resp.Header.Get(codersdk.BuildVersionHeader) != "" {
isCoderErr = fmt.Errorf("proxy url %q is a coder instance, but unable to decode the response payload. Could this be a primary coderd and not a proxy?", reqURL)
}

// If the response is not json, then the user likely input a bad url that returns status code 200.
// This is very common, since most webpages do return a 200. So let's improve the error message.
if notJsonErr := codersdk.ExpectJSONMime(resp); notJsonErr != nil {

err = errors.Join(
isCoderErr,
fmt.Errorf("attempted to query health at %q but got back the incorrect content type: %w", reqURL, notJsonErr),
)

status.Report.Errors = []string{
err.Error(),
}
status.Status = Unhealthy
break
}

// If we cannot read the report, mark the proxy as unhealthy.
status.Report.Errors = []string{fmt.Sprintf("failed to decode health report: %s", err.Error())}
status.Report.Errors = []string{
errors.Join(
isCoderErr,
fmt.Errorf("received a status code 200, but failed to decode health report body: %w", err.Error()),
).Error(),
}
status.Status = Unhealthy
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The json decode error is usually absolute garbage. So this should improve it.

It also does a header check to instantly tell the user if they are not even pointed at a coder instance at all (proxy or otherwise)

@EmyrkEmyrk requested review fromsreya andbpmctJanuary 11, 2024 22:58
@EmyrkEmyrkenabled auto-merge (squash)January 12, 2024 14:56
@EmyrkEmyrk merged commit9052920 intomainJan 12, 2024
@EmyrkEmyrk deleted the stevenmasley/wsproxy_no_json_error branchJanuary 12, 2024 20:32
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJan 12, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@sreyasreyasreya approved these changes

@bpmctbpmctAwaiting requested review from bpmct

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

workspace proxies: unique health check error if being treated as a subdomain app
2 participants
@Emyrk@sreya

[8]ページ先頭

©2009-2025 Movatter.jp