getsentry / sentry-fastlane-plugin

Official fastlane plugin for Sentry
https://sentry.io
MIT License
136 stars 50 forks source link

1.12.2 error parsing sentry auth result #145

Closed jpaas closed 2 years ago

jpaas commented 2 years ago

Environment

Sentry SaaS (sentry.io)

Which SDK and version? javascript 7.6.0 fastlane 2.207.0

Steps to Reproduce

Ran fastlane and hit this problem with the first sentry command it encountered which was sentry_create_release

Expected Result

It would create the release like it always had.

Actual Result

It seems to be trying to json parse a string that contains a lot more than json.

/Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/json-2.6.2/lib/json/common.rb:216:in `parse': \e[1;31m[!] 859: unexpected token at 'INFO    2022-07-15 13:34:10.107333 -04:00 Loaded config from /Users/jpaas/.sentryclircDEBUG   2022-07-15 13:34:10.107790 -04:00 sentry-cli version: 2.4.1, platform: "darwin", architecture: "arm64"INFO    2022-07-15 13:34:10.107797 -04:00 sentry-cli was invoked with the following command line: "/opt/homebrew/bin/sentry-cli" "info" "--config-status-json"DEBUG   2022-07-15 13:34:10.108175 -04:00 request GET https://sentry.io/api/0/DEBUG   2022-07-15 13:34:10.108181 -04:00 using token authenticationDEBUG   2022-07-15 13:34:10.108353 -04:00 retry number 0, max retries: 0DEBUG   2022-07-15 13:34:10.341690 -04:00 > GET /api/0/ HTTP/1.1DEBUG   2022-07-15 13:34:10.341711 -04:00 > Host: sentry.ioDEBUG   2022-07-15 13:34:10.341715 -04:00 > Accept: */*DEBUG   2022-07-15 13:34:10.341718 -04:00 > Connection: TEDEBUG   2022-07-15 13:34:10.341727 -04:00 > TE: gzipDEBUG   2022-07-15 13:34:10.341730 -04:00 > User-Agent: sentry-cli/2.4.1DEBUG   2022-07-15 13:34:10.342051 -04:00 > Authorization: Bearer 396fe3d3***DEBUG   2022-07-15 13:34:10.404523 -04:00 < HTTP/1.1 200 OKDEBUG   2022-07-15 13:34:10.404549 -04:00 < Server: nginxDEBUG   2022-07-15 13:34:10.404556 -04:00 < Date: Fri, 15 Jul 2022 17:34:10 GMTDEBUG   2022-07-15 13:34:10.404563 -04:00 < Content-Type: application/jsonDEBUG   2022-07-15 13:34:10.404569 -04:00 < Content-Length: 1302DEBUG   2022-07-15 13:34:10.404576 -04:00 < Connection: keep-aliveDEBUG   2022-07-15 13:34:10.404581 -04:00 < allow: GET, HEAD, OPTIONSDEBUG   2022-07-15 13:34:10.404587 -04:00 < access-control-allow-methods: GET, HEAD, OPTIONSDEBUG   2022-07-15 13:34:10.404601 -04:00 < access-control-allow-headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding, sentry-trace, baggageDEBUG   2022-07-15 13:34:10.404609 -04:00 < access-control-expose-headers: X-Sentry-Error, Retry-AfterDEBUG   2022-07-15 13:34:10.404615 -04:00 < access-control-allow-origin: *DEBUG   2022-07-15 13:34:10.404620 -04:00 < x-sentry-rate-limit-remaining: 39DEBUG   2022-07-15 13:34:10.404626 -04:00 < x-sentry-rate-limit-limit: 40DEBUG   2022-07-15 13:34:10.404631 -04:00 < x-sentry-rate-limit-reset: 1657906451DEBUG   2022-07-15 13:34:10.404636 -04:00 < x-sentry-rate-limit-concurrentremaining: 24DEBUG   2022-07-15 13:34:10.404643 -04:00 < x-sentry-rate-limit-concurrentlimit: 25DEBUG   2022-07-15 13:34:10.404649 -04:00 < vary: Accept-Language, CookieDEBUG   2022-07-15 13:34:10.404656 -04:00 < content-language: enDEBUG   2022-07-15 13:34:10.404661 -04:00 < x-frame-options: denyDEBUG   2022-07-15 13:34:10.404666 -04:00 < x-content-type-options: nosniffDEBUG   2022-07-15 13:34:10.404671 -04:00 < x-xss-protection: 1; mode=blockDEBUG   2022-07-15 13:34:10.404677 -04:00 < set-cookie: session=eyJfbGFuZ3VhZ2UiOiJlbiJ9:1oCPCc:9OdMw28AEgYfwHSqRYsQkHaXEco; expires=Fri, 29 Jul 2022 17:34:10 GMT; HttpOnly; Max-Age=1209600; Path=/; SecureDEBUG   2022-07-15 13:34:10.404683 -04:00 < x-envoy-attempt-count: 1DEBUG   2022-07-15 13:34:10.404688 -04:00 < x-envoy-upstream-service-time: 31DEBUG   2022-07-15 13:34:10.404693 -04:00 < x-served-by: getsentry-web-default-production-78b9cfb578-92cpgDEBUG   2022-07-15 13:34:10.404698 -04:00 < x-served-by: lb-1DEBUG   2022-07-15 13:34:10.404706 -04:00 < Strict-Transport-Security: max-age=31536000; includeSubDomains; preloadDEBUG   2022-07-15 13:34:10.404728 -04:00 response status: 200DEBUG   2022-07-15 13:34:10.404736 -04:00 body: {"version":"0","auth":{"scopes":["event:admin","event:read","member:read","org:read","project:read","project:releases","team:read"]},"user":{"id":"124956","name":"Julian Paas","username":"julian.paas@karmacasting.com","email":"julian.paas@karmacasting.com","avatarUrl":"https://secure.gravatar.com/avatar/ac76237392d925c99ec154af0a436ef6?s=32&d=mm","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2017-03-24T22:55:28.694232Z","lastLogin":"2022-07-14T16:47:45.869870Z","has2fa":true,"lastActive":"2022-07-15T17:34:10.427137Z","isSuperuser":false,"isStaff":false,"experiments":{},"emails":[{"id":"809673","email":"julian.paas@osaaru.com","is_verified":true},{"id":"809671","email":"julian.paas@imdhealth.com","is_verified":true},{"id":"123319","email":"julian.paas@karmacasting.com","is_verified":true}],"options":{"theme":"light","language":"en","stacktraceOrder":-1,"timezone":"America/Toronto","clock24Hours":false},"flags":{"newsletter_consent_prompt":false},"avatar":{"avatarType":"upload","avatarUuid":"8c20de86f7f1418c95114848bcdf51cd"},"identities":[{"id":"146222","name":"1231716","organization":{"slug":"imd-health","name":"iMD Health"},"provider":{"id":"github","name":"GitHub"},"dateSynced":"2022-07-15T17:18:28.234904Z","dateVerified":"2022-07-15T17:18:28.234904Z"}]}}{"config": {"org": null,"project": null,"url": "https://sentry.io"},"auth": {"type": "token","successful": true},"have_dsn": false}DEBUG   2022-07-15 13:34:10.406972 -04:00 skipping update nagger because session is not attended'\e[0m (JSON::ParserError)
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/json-2.6.2/lib/json/common.rb:216:in `parse'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-plugin-sentry-1.12.2/lib/fastlane/plugin/sentry/helper/sentry_config.rb:84:in `fallback_sentry_cli_auth'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-plugin-sentry-1.12.2/lib/fastlane/plugin/sentry/helper/sentry_config.rb:60:in `parse_api_params'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-plugin-sentry-1.12.2/lib/fastlane/plugin/sentry/actions/sentry_create_release.rb:7:in `run'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    from Fastfile:439:in `block (2 levels) in parsing_binding'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/lane.rb:33:in `call'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/lane_manager.rb:47:in `cruise_lane'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/commands_generator.rb:354:in `run'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/gems/fastlane-2.207.0/bin/fastlane:23:in `<top (required)>'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/bin/fastlane:25:in `load'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/bin/fastlane:25:in `<main>'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/bin/ruby_executable_hooks:22:in `eval'
    from /Users/jpaas/.rvm/gems/ruby-3.1.2@worker-native-app/bin/ruby_executable_hooks:22:in `<main>'
philipphofmann commented 2 years ago

@jpaas, on which version did it work the last time for you?

jpaas commented 2 years ago

@philipphofmann I rolled back to 1.11.1 and it works

philipphofmann commented 2 years ago

Hm, I just tried it with a sample app and sentry_create_release worked for me.

sentry_create_release(
  auth_token: ENV["SENTRY_AUTH_TOKEN"],
  version: '1.0.0-alpha.1',
  finalize: true
)

But I guess that's because my sample doesn't use the fallback_sentry_cli_auth. The error seems to happen when trying to parse the JSON here https://github.com/getsentry/sentry-fastlane-plugin/blob/369affccf9e6570cb52275d1c0dfb7e016fe6cb8/lib/fastlane/plugin/sentry/helper/sentry_config.rb#L84-L90

@kamilogorek, as you touched this code recently, do you have any idea what could cause this?