sentry-dart-plugin icon indicating copy to clipboard operation
sentry-dart-plugin copied to clipboard

`sentry.properties` ignored

Open dickermoshe opened this issue 1 year ago • 1 comments
trafficstars

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.

dickermoshe avatar Apr 22 '24 15:04 dickermoshe

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

buenaflor avatar Apr 24 '24 14:04 buenaflor

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!

ospaarmann avatar May 28 '24 12:05 ospaarmann

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 avatar May 28 '24 12:05 buenaflor

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

buenaflor avatar May 28 '24 12:05 buenaflor

@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..    

denrase avatar Jun 03 '24 09:06 denrase

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.

ospaarmann avatar Jun 03 '24 11:06 ospaarmann

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

denrase avatar Jun 03 '24 11:06 denrase

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"

ospaarmann avatar Jun 03 '24 12:06 ospaarmann

@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.

denrase avatar Jun 03 '24 13:06 denrase

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

ospaarmann avatar Jun 03 '24 18:06 ospaarmann