getsentry / sentry-dart-plugin

A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli
MIT License
68 stars 28 forks source link

`sentry.properties` ignored #231

Closed dickermoshe closed 5 months ago

dickermoshe commented 7 months ago

Environment

Dart 3.3.3 (stable) (Tue Mar 26 14:21:33 2024 +0000) on "windows_x64" sentry_dart_plugin: ^1.6.0

Steps to Reproduce

  1. Place sentry config in sentry.properties instead of pubspec.yaml

Expected Result

Work

Actual Result

[❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 0% reading config values..        
Downloaded Sentry CLI binary checksum verification passed successfully (hash: 1e91fbdd81dceb372855f59d2526c1f2de4ea5a51157670e5070a914efd1f09c).
☑ reading config values
[❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 9% validating config values..
Project is empty, check 'project' at pubspec.yaml or SENTRY_PROJECT env. var.

Organization is empty, check 'org' at pubspec.yaml or SENTRY_ORG env. var.

Auth Token is empty, check 'auth_token' at pubspec.yaml or SENTRY_AUTH_TOKEN env. var.
buenaflor commented 7 months ago

hey currently you need to have the required fields still in the pubspec field. we'll see to it so we can change this

ospaarmann commented 6 months ago

hey currently you need to have the required fields still in the pubspec field. we'll see to it so we can change this

Hey,

Could you clarify your previous message? Specifically, is it necessary to place the configuration solely in the pubspec file, or does sentry.properties still function? If both are needed, is it possible to include placeholder data in the pubspec?

I'm also concerned about the security implications of storing the authentication token in pubspec.yaml, as it would require including sensitive information in version control. Is there an alternative approach that I might be overlooking?

Thank you!

buenaflor commented 6 months ago

There's a mistake in our readme and should be updated, sentry.properties does not yet support the project, org, and auth token field.

I'm also concerned about the security implications of storing the authentication token in pubspec.yaml

You can also use an environment variable SENTRY_AUTH_TOKEN in that case

buenaflor commented 6 months ago

We will provide a fix soon for this so sentry.properties can be a standalone piece of configuration

denrase commented 5 months ago

@dickermoshe This sould work with the most recent version. Please upgrade and male sure you completley remove sentry config in pubspec and move it to the properties file, mixing both is not supported. Just confirmed this with our flutter example app.

Built sentry_dart_plugin:sentry_dart_plugin.
[❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 0% reading config values..        
Downloading sentry-cli from https://downloads.sentry-cdn.com/sentry-cli/2.27.0/sentry-cli-Darwin-universal to .dart_tool/pub/bin/sentry_dart_plugin/sentry-cli

Downloaded Sentry CLI binary checksum verification passed successfully (hash: 8693527282890285f55d9b55414905e8621dd788ad3ae4c85175b84e8eeb6a04).

Sentry CLI downloaded successfully.

sentry config not found in pubspec.yaml

retrieving config from sentry.properties
☑ reading config values                                                             
☑ validating config values                                                             
[❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 18% uploading debug symbols..    
ospaarmann commented 5 months ago

I just upgraded to the latest version (2.0.0) and moved all configuration to sentry.properties. It does not work:

dart run sentry_dart_plugin
Building package executable... 
Built sentry_dart_plugin:sentry_dart_plugin.
[❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 0% reading config values..        
sentry config not found in pubspec.yaml

retrieving config from sentry.properties

Downloading Sentry CLI 2.31.0 from https://downloads.sentry-cdn.com/sentry-cli/2.31.0/sentry-cli-Darwin-universal to .dart_tool/pub/bin/sentry_dart_plugin/sentry-cli

Sentry CLI binary checksum verification passed successfully (hash: 5d12bee428d18ca49657f2573b130a0c5990a665e0cbe6fad583e72a2fd1e3cc).

Sentry CLI downloaded successfully.
☑ reading config values                                                             
[❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 9% validating config values..                             
Project is empty, check 'project' at pubspec.yaml or SENTRY_PROJECT env. var.

Organization is empty, check 'org' at pubspec.yaml or SENTRY_ORG env. var.

Auth Token is empty, check 'auth_token' at pubspec.yaml or SENTRY_AUTH_TOKEN env. var.
denrase commented 5 months ago

@ospaarmann Could you share the contents of the properties file? You can redact the values.

ospaarmann commented 5 months ago

Sure thing

./sentry.properties

# This is not used atm, see: https://github.com/getsentry/sentry-dart-plugin/issues/231

upload_debug_symbols: true
upload_source_maps: true
upload_sources: true
project: my_project
org: my-org
auth_token: REDACTED
# url: ...
wait_for_processing: false
log_level: error
# release: ...
# web_build_path: ...
commits: auto
ignore_missing: true

And the relevant part of ./pubspec.lock

sentry:
    dependency: transitive
    description:
      name: sentry
      sha256: "961630a4dba41cebd692612421fd3805a991ebd8ef4a8d84a6c179e6b89eaf22"
      url: "https://pub.dev"
    source: hosted
    version: "8.0.0"
  sentry_dart_plugin:
    dependency: "direct dev"
    description:
      name: sentry_dart_plugin
      sha256: "2ad5ef14bf99776fa3fea09c53d275732a23c963e68f20c2facea379cce5e7c6"
      url: "https://pub.dev"
    source: hosted
    version: "2.0.0"
  sentry_flutter:
    dependency: "direct main"
    description:
      name: sentry_flutter
      sha256: "705da7adfcd1fb23fc8720b6e222f5e03d53f1d020cd635586c319ee323366b4"
      url: "https://pub.dev"
    source: hosted
    version: "8.0.0"
denrase commented 5 months ago

@ospaarmann The syntax for .properties files is different. You have to use = instead of ": "

upload_debug_symbols=true
upload_source_maps=true
upload_sources=true
project=my_project
org=my-org
auth_token=REDACTED
# url=...
wait_for_processing=false
log_level=error
# release=...
# web_build_path=...
commits=auto
ignore_missing=true

This should do the trick. I will close this issue for now.

ospaarmann commented 5 months ago

That did indeed do the trick. Thanks @denrase ❤️