Sentry Error Tracking using Gitlab produces 500 using Sentry test_message command
Summary
When adding a Rails based project and enabling Sentry Error Tracking with GitLab Basic tracking, I receive a 500 error with no logging using the Sentry.capture_message("test message") test command.
Steps to reproduce
- rails new TestProject
- add these to Gemfile:
gem "sentry-ruby"
gem "sentry-rails"
- add
config/initializers/sentry.rbwith and adjusting theconfig.dsnwith the correct settings.
Sentry.init do |config|
config.dsn = 'https://examplePublicKey@o0.ingest.sentry.io/0'
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
end
- Open
rails cand useSentry.capture_message("test message")
What is the current bug behavior?
Server returns a 500 error with the following lines of backtrace:
NoMethodError (undefined method `[]' for nil:NilClass):
/home/git/gitlab/app/services/error_tracking/collect_error_service.rb:35:in `exception'
/home/git/gitlab/app/services/error_tracking/collect_error_service.rb:10:in `execute'
/home/git/gitlab/lib/api/error_tracking/collector.rb:93:in `block in <class:Collector>'
What is the expected correct behavior?
Error properly reported and displayed within GitLab
Results of GitLab environment info
Expand for output related to the GitLab application check
System information System: Ubuntu 18.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.7.4p191 Gem Version: 3.1.6 Bundler Version:2.1.4 Rake Version: 13.0.6 Redis Version: 6.0.6 Git Version: 2.33.1 Sidekiq Version:6.2.2 Go Version: go1.16.8 linux/amd64GitLab information Version: 14.4.0-ee Revision: 19c719febd7 Directory: /home/git/gitlab DB Adapter: PostgreSQL DB Version: 13.3 URL: https://gitlab.tapenvy.us HTTP Clone URL: https://gitlab.tapenvy.us/some-group/some-project.git SSH Clone URL: git@gitlab.tapenvy.us:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: github
GitLab Shell Version: 13.21.1 Repository storage paths:
- default: /home/git/repositories GitLab Shell path: /home/git/gitlab-shell Git: /usr/bin/git
Results of GitLab application Check
Note: Init script error is due to testing the systemd MR. System is running normally otherwise.
Expand for output related to the GitLab application check
Checking GitLab subtasks ...Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 13.21.1 ? ... OK (13.21.1) Running /home/git/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 0/1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Checking Reply by email ...
IMAP server credentials are correct? ... Checking gitlab@tapenvy.us yes Init.d configured correctly? ... yes MailRoom running? ... yes
Checking Reply by email ... Finished
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... no Try fixing it: Install the init script For more information see: doc/install/installation.md in section "Install Init Script" Please fix the error above and rerun the checks. Init script up-to-date? ... can't check because of previous errors Projects have namespace: ... 2/7 ... yes 2/11 ... yes 17/12 ... yes 17/17 ... yes 32/19 ... yes 2/20 ... yes 32/24 ... yes 2/25 ... yes 17/28 ... yes 17/29 ... yes 24/35 ... yes 31/39 ... yes 17/40 ... yes 17/43 ... yes 17/44 ... yes 17/45 ... yes 19/46 ... yes 17/47 ... yes 19/48 ... yes 27/50 ... yes 17/51 ... yes 27/52 ... yes 24/54 ... yes 24/55 ... yes 32/56 ... yes 31/59 ... yes 24/61 ... yes 31/63 ... yes 24/64 ... yes 27/65 ... yes 31/66 ... yes 24/67 ... yes 17/68 ... yes 17/70 ... yes 1/71 ... yes 17/74 ... yes 17/76 ... yes 24/78 ... yes 27/80 ... yes 39/81 ... yes 17/82 ... yes 17/83 ... yes 47/85 ... yes 17/86 ... yes 1/87 ... yes 32/88 ... yes 47/89 ... yes 47/90 ... yes 47/91 ... yes 47/92 ... yes 47/93 ... yes 47/94 ... yes 24/95 ... yes 47/96 ... yes 24/97 ... yes 47/98 ... yes 54/99 ... yes 24/100 ... yes 54/101 ... yes 17/102 ... yes 47/103 ... yes 24/104 ... yes 57/106 ... yes 57/107 ... yes 47/108 ... yes 17/109 ... yes 24/110 ... yes 47/111 ... yes 47/112 ... yes 17/113 ... yes 47/114 ... yes 47/115 ... yes 47/116 ... yes 61/117 ... yes 47/118 ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.4) Git version >= 2.33.0 ? ... yes (2.33.1) Git user has default SSH configuration? ... yes Active users: ... 15 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x (6.4 - 6.x deprecated to be removed in 13.8)? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished