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

Fix cryptic "SocketException" when API token is invalid #1871

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

bartekpacia
Copy link
Member

@bartekpacia bartekpacia commented Aug 2, 2024

aimed at aiding with investigation of #1856

Problem

When API token is invalid, CLI shows a cryptic "socket exception" instead of "invalid token".

Root cause

Our server closes request when it determines that request is unauthorized/has bad token.

However OkHttp did not handle that situation before v4.11.0, and we used 4.10.0. Instead of gracefully handling closed connection and returning the response, it still tried writing to the connection (that had been already closed by the server), and crashed with socket exception: broken pipe.

fyi @igorsmotto @amanjeetsingh150

More context

@bartekpacia bartekpacia changed the title Bump OkHttp (4.10.0 -> 4.12.0) Fix cryptic "SocketException" when API token is invalid Aug 2, 2024
@bartekpacia bartekpacia merged commit bcf1080 into main Aug 2, 2024
4 checks passed
@bartekpacia bartekpacia deleted the fix/socket_exception_error branch August 2, 2024 10:35
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 this pull request may close these issues.

2 participants