Skip to content

[sentry_dio] Unhelpful and verbose issue captured following failed HTTP status #2914

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

Open
scopendo opened this issue May 6, 2025 · 2 comments
Assignees
Labels
dart Pull requests that update Dart code Improvement

Comments

@scopendo
Copy link

scopendo commented May 6, 2025

Platform

Dart

Obfuscation

Enabled

Debug Info

Enabled

Doctor

[✓] Flutter (Channel stable, 3.29.3, on macOS 15.4.1 24E263 darwin-arm64, locale en-GB) [4.2s]
• Flutter version 3.29.3 on channel stable at /Users/Scott/Developer/fvm/versions/stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ea121f8859 (4 weeks ago), 2025-04-11 19:10:07 +0000
• Engine revision cf56914b32
• Dart version 3.7.2
• DevTools version 2.42.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [8.7s]
• Android SDK at /Users/Scott/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = /Users/Scott/Library/Android/sdk
• Java binary at: /Users/Scott/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: flutter config --jdk-dir="path/to/jdk".
• Java version OpenJDK Runtime Environment (build 17.0.2+8-86)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.3) [1,702ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16E140
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web [33ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [32ms]
• Android Studio at /Users/Scott/Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)

[✓] IntelliJ IDEA Ultimate Edition (version 2025.1) [31ms]
• IntelliJ at /Users/Scott/Applications/IntelliJ IDEA Ultimate.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (4 available) [7.1s]
• iPhone 16 Plus (mobile) • 9420837B-BDC8-460F-9FE2-1B060BEC20FB • ios •
com.apple.CoreSimulator.SimRuntime.iOS-18-4 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.4.1 24E263 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.4.1 24E263 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 135.0.7049.115

[✓] Network resources [339ms]
• All expected network resources are available.

• No issues found!

Version

8.14.1

Steps to Reproduce

Initialise Sentry Dio integration and then make an API call that returns a failure status code:

dio.addSentry(
  captureFailedRequests: false,
  failedRequestStatusCodes: [
    SentryStatusCode.range(500, 599),
    SentryStatusCode(403),
  ],
);

Expected Result

I'm seeing a lot of issues in Sentry with descriptions like the following:

Qx
DioException [bad response]: This exception was thrown because the response has a status code of 502 and RequestOptions.validateStatus was configured to throw for this status code.
The status code of 502 has the following meaning: "Server error - the server failed to fulfil an apparently valid request"
Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code.

Putting aside why we might be getting an HTTP 502 response, it seems to me that this message is quite verbose and that a more useful message might be something like (for example):

DioException [bad response]: Status 502 response calling POST /booking/check

I also don't understand why the issue title is (for example) Qx. It seems like obfuscation, but we have uploaded our symbol files and can see accurate call stack details.

Actual Result

A more useful issue title and body.

Are you willing to submit a PR?

None

Copy link
Contributor

buenaflor commented May 6, 2025

The log does indeed seem verbose, I'll have a look

I also don't understand why the issue title is (for example) Qx. It seems like obfuscation, but we have uploaded our symbol files and can see accurate call stack details.

In obfuscated builds class types are obfuscated and used for the issue title and we have an open issue for that and will be working on this soon this quarter. De-obfuscating class types require some extra steps (see here) that we dont have in place yet.

You can temporarily apply a fix as seen in this doc by using the options.prependExceptionIdentifier however this is only a temporary solution until we have fixed the issue in our symbolication process

@scopendo
Copy link
Author

scopendo commented May 6, 2025

Thank you for the helpful answer.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 6, 2025
@getsantry getsantry bot removed the status in GitHub Issues with 👀 3 May 6, 2025
@buenaflor buenaflor self-assigned this May 6, 2025
@stephanie-anderson stephanie-anderson added the dart Pull requests that update Dart code label May 7, 2025 — with Linear
@buenaflor buenaflor added the Improvement label May 9, 2025 — with Linear
@buenaflor buenaflor removed the bug label May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dart Pull requests that update Dart code Improvement
Projects
Status: No status
Status: Needs Discussion
Development

No branches or pull requests

3 participants