FLutter web:哨兵未正确翻译问题

问题描述 投票:0回答:1

我在我的项目中使用哨兵。添加其依赖项后,我在主 dart 上添加了其配置:

void main() {
  runZonedGuarded(() async {
    await setupSentrySameZone(
        "https://d88a433.....ingest.us.sentry.io/4507....");
    runApp(
      SentryWidget(
        child: DefaultAssetBundle(
          bundle: SentryAssetBundle(),
          child: EasyLocalization(
            supportedLocales: LocalizationConst.supportedLocales,
            path: LocalizationConst.localesPath,
            fallbackLocale: LocalizationConst.defaultLocale,
            useOnlyLangCode: true,
            assetLoader: const CodegenLoader(),
            child: .....,
        ),
      ),
    );
  }, (exception, stackTrace) async {
    await Sentry.captureException(exception, stackTrace: stackTrace);
  });

和 setupSentrySameZone 方法:

Future<void> setupSentrySameZone(
  String dsn, {
  bool isIntegrationTest = false,
  BeforeSendCallback? beforeSendCallback,
}) async {
  await SentryFlutter.init(
    (options) {
      options.dsn = dsn;
      options.tracesSampleRate = 1.0;
      options.profilesSampleRate = 1.0;
      options.enableAutoSessionTracking = false;
      options.reportPackages = false;
      options.considerInAppFramesByDefault = false;
      options.attachThreads = true;
      options.enableWindowMetricBreadcrumbs = true;
      options.sendDefaultPii = true;
      options.reportSilentFlutterErrors = true;
      options.attachScreenshot = true;
      options.screenshotQuality = SentryScreenshotQuality.low;
      options.attachViewHierarchy = true;
      options.debug = true;
      options.spotlight = Spotlight(enabled: true);
      options.enableTimeToFullDisplayTracing = true;
      options.maxRequestBodySize = MaxRequestBodySize.always;
      options.maxResponseBodySize = MaxResponseBodySize.always;
      if (isIntegrationTest) {
        options.dist = '1';
        options.environment = 'integration';
        options.beforeSend = beforeSendCallback;
      }
    },
  );
}

我也在用

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^2.4.6
  sentry_dart_plugin: ^1.0.0

我还有 puspec.yml 我添加了哨兵配置:

sentry:
  upload_debug_symbols: false
  upload_source_maps: true
  upload_sources: false
  project: my_project_name
  org: myOrg
  auth_token: a9.....87
  log_level: error

对于 CI/CD 部分,我使用的是 firebase,所以这是我的管道部分:

  - run: flutter pub get
  - run: melos run generate:flutter
  - run: flutter build web --release --dart-define=dart.vm.product=true --source-maps
  # Upload source maps to Sentry
  - name: Upload source maps to Sentry
    run: flutter pub run sentry_dart_plugin

当我构建网络版本时,一切都很好,管道工作正常,但是当我在哨兵问题配置文件上遇到问题时,我认为源映射无法正常工作,这是哨兵上的问题:

flutter sentry
1个回答
0
投票

我要做一个疯狂的猜测,并说这是因为 Web 构建的缩小:我在 Flutter Web 上也遇到了类似的问题(尽管不是 Sentry),其中数据库列名称因默认情况下包含的缩小而改变Web平台的构建脚本。仅使用

a
b
等的奇怪而简短的语法让我想起了这个问题。
尝试通过在终端上运行它来编译您的应用程序来构建网络应用程序

flutter build web --profile --dart-define=Dart2jsOptimization=O1
© www.soinside.com 2019 - 2024. All rights reserved.