getsentry/sentry-dart

"could not determine a source map reference" after upgrade

rodrigo-itao opened this issue · 9 comments

Platform

Flutter Web

Obfuscation

Disabled

Debug Info

Disabled

Doctor

[✓] Flutter (Channel stable, 3.19.6, on Ubuntu 22.04.4 LTS 5.15.0-106-generic, locale en_US.UTF-8)
    • Flutter version 3.19.6 on channel stable at /home/rodrigo/Documents/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (3 weeks ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[!] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /home/rodrigo/Android/Sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] VS Code (version 1.89.1)
    • VS Code at /snap/code/current/usr/share/code
    • Flutter extension version 3.88.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.4 LTS 5.15.0-106-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 124.0.6367.155

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

! Doctor found issues in 3 categories.

Version

8.1.0

Steps to Reproduce

After upgrading to sentry_flutter 8.1.0 from sentry_flutter 7.20.2, I'm encountering these warnings when running flutter packages pub run sentry_dart_plugin:

...

Source Map Upload Report
  Scripts
    ~/lib/core/models/agendamento/agendamento.dart (no sourcemap ref)
      - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/lib/core/models/agendamento/agendamento.dart)
~/lib/core/models/agendamento/agendamento.freezed.dart (no sourcemap ref)
      - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/lib/core/models/agendamento/agendamento.freezed.dart)
    ~/lib/core/models/agendamento/agendamento.g.dart (no sourcemap ref)
      - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/lib/core/models/agendamento/agendamento.g.dart)
    ~/lib/core/models/agendamento/agendamento_lowlevel.dart (no sourcemap ref)
      - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/lib/core/models/agendamento/agendamento_lowlevel.dart)
    ~/lib/core/models/agendamento/agendamento_lowlevel.freezed.dart (no sourcemap ref)
      - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/lib/core/models/agendamento/agendamento_lowlevel.freezed.dart)

...

Additionally, it seems that exceptions are not being captured correctly, as the stack traces are incomplete:

image
image

main.dart:

Future<void> main() async {
  runZonedGuarded(
    () async {

      await SentryFlutter.init(
        (options) {
          options.dsn = dsn;
          options.tracesSampleRate = 1.0;
          options.environment = environment;
          options.attachScreenshot = true;
          options.release = release;
        },
      );

      runApp(
        ProviderScope(
          child: SentryScreenshotWidget(
            child: const MyApp(),
          ),
        ),
      );
    },
    (error, stack) async {
      await Sentry.captureException(error, stackTrace: stack);
    },
  );
}

pubspec.yaml:

...

sentry:
  upload_debug_symbols: true
  upload_source_maps: true
  upload_sources: true
  project: 'frontend'
  org: 'org'
  auth_token: 'token'
  commits: auto
  ignore_missing: true
  wait_for_processing: true
  release: frontend@0.0.0+1


Expected Result

Actual Result

Are you willing to submit a PR?

None

I tested downgrading sentry_dart_plugin to version 1.7.1 while keeping sentry_flutter 8.1.0, and now the warning 'could not determine a source map reference' is not appearing anymore, and the stack traces are complete now.

So, I think the problem lies with sentry_dart_plugin 2.0.0.

@denrase Can you please take a look

getsentry/sentry-dart-plugin#203 looks related
I am getting the same error for every source file though.

@buenaflor I checked with sentry-cli v2.31.0 and v2.32.0. Both do not work. Downgrading to v2.27.0 fixed the issue for me:

> Found 13 files

> Analyzing 13 sources

> Rewriting sources
> Adding source map references

> Bundled 13 files for upload
> Bundle ID: 9ffe95e4-3ee6-561c-bcf8-bdd24d19d351

> Nothing to upload, all files are on the server

> File processing complete
> Organization: sentry-sdks
> Project: sentry-flutter
> Release: sentry_flutter_example@8.2.0
> Dist: None
> Upload type: artifact bundle

Source Map Upload Report
  Scripts
    ~/integration_test/all.dart
    ~/integration_test/integration_test.dart
    ~/integration_test/profiling_test.dart
    ~/lib/auto_close_screen.dart
    ~/lib/drift/connection/connection.dart
    ~/lib/drift/connection/native.dart
    ~/lib/drift/connection/unsupported.dart
    ~/lib/drift/database.dart
    ~/lib/drift/database.g.dart
    ~/lib/isar/user.dart
    ~/lib/isar/user.g.dart
    ~/lib/main.dart
    ~/lib/user_feedback_dialog.dart
☑ uploading source maps     

So the issue seems to be with sentry-cli, and not with the plugin itself.

As a workaround, users can stick with 1.7.1 or provide a path to a local sentry-cli binary with bin_path param, which is a new feature we have introduced in 2.0.0.

Would it make sense to add a feature to specify a custom CLI version instead of a path?

@kuhnroyal I think that might a good addition if we can easily do it

Thanks for adding that CLI version parameter. Is the underlying problem in the CLI fixed?

Is the underlying problem in the CLI fixed

Unfortunately no, we haven't had the time to investigate this further.

I rolled back the default cli version it works on.
When we have more time we can take a closer look but currently it should be fine to keep the cli version as it is unless there's some urgent feature we need from a higher version.