You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently we started using Sentry Releases feature, which required adding this configuration into our Sentry initializer:
Sentry.initdo |config|
config.dsn=Settings.sentry.dsnconfig.enabled_environments=%w[stagingproduction]config.release='test-release'# <--- New configend
Unfortunately, even having enabled only staging and production environments, Sentry gem still tries to send Session info in the development environment (where we have fake dsn). This leads to the next error in the logs in 1 minutes after rails server boot and processing the first request:
2024-01-16 15:24:29.174419 I Rails -- sentry -- [Transport] Sending envelope with items [sessions] to Sentry
2024-01-16 15:24:29.464377 E Rails -- sentry -- exception happened in background worker: the server responded with status 403
body:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="robots" content="NONE,NOARCHIVE">
<link href="https://s1.sentry-cdn.com/_static/4fc9771d060bd95f1ae524d288b5113c/sentry/images/favicon.ico" rel="shortcut icon" type="image/png"/>
<link href="https://s1.sentry-cdn.com/_static/dist/sentry/entrypoints-hashed/sentry-_T-wZwCCznWSPyllnW1TsVKgRkJORZKGIT_ZNYwFNG4.css" rel="stylesheet" type="text/css" />
<title>CSRF Verification Failed | Sentry</title>
<style type="text/css">
header {
padding: 40px 0;
font-size: 15px;
margin-bottom: 40px;
}
.container {
max-width: 1040px;
}
</style>
</head>
<body>
<header>
<div class="container">
<div class="pull-left">
<a href="/" id="logo"><img src="https://s1.sentry-cdn.com/_static/4fc9771d060bd95f1ae524d288b5113c/getsentry/images/logo.png" /></a>
</div>
</div>
</header>
<section id="content">
<div class="container">
<div class="page-header">
<h2>CSRF Verification Failed</h2>
</div>
<p>A required security token was not found or was invalid.</p>
<p>If you're continually seeing this issue, try the following:</p>
<ol>
<li>Clear cookies (at least for Sentry's domain).</li>
<li>Reload the page you're trying to submit (don't re-submit data).</li>
<li>Re-enter the information, and submit the form again.</li>
<li>Ensure the URL does not contain an extra "/" anywhere (eg: https://foo//saml -> https://foo/saml).</li>
</ol>
<p>Read more about <a href="https://en.wikipedia.org/wiki/Cross-site_request_forgery">CSRF on Wikipedia</a>.</p>
<div class="page-header">
<h3>System Status</h3>
</div>
<p><strong><span id="official-system-status"></span></strong></p>
<p>If our status page says we're up but something is clearly wrong, <a href="mailto:support@sentry.io">let us know</a> what you're seeing.</p>
<script nonce="EtZB05K0phwCqYprzxO7RQ==" src="https://statuspage-production.s3.amazonaws.com/se.js" type="text/javascript"></script>
<script nonce="EtZB05K0phwCqYprzxO7RQ==" type="text/javascript">window.fetchStatusPage({
pageId: 't687h3m0nh65',
renderTo: '#official-system-status'
});</script>
</div>
</section>
</body>
</html>
Reproduction Steps
$ rails new test-sentry-ruby
$ cd test-sentry-ruby
$ bundle add sentry-ruby sentry-rails
Add config/initializers/sentry.rb with the next configuration:
Issue Description
Recently we started using Sentry Releases feature, which required adding this configuration into our Sentry initializer:
Unfortunately, even having enabled only
staging
andproduction
environments, Sentry gem still tries to send Session info in thedevelopment
environment (where we have fakedsn
). This leads to the next error in the logs in 1 minutes after rails server boot and processing the first request:Reproduction Steps
$ rails new test-sentry-ruby
$ cd test-sentry-ruby
$ bundle add sentry-ruby sentry-rails
config/initializers/sentry.rb
with the next configuration:rails server
and open the home page in the browser - http://localhost:3000/development.log
fileExpected Behavior
No Sentry-related errors in logs as
development
env is not listed inenabled_enviroments
.Actual Behavior
Bunch of errors in
development.log
file:Ruby Version
3.2.2
SDK Version
5.16.1 (also confirmed in 5.5)
Integration and Its Version
Rails = 7.1.2 (also confirmed in Rails 7.0.4)
Sentry Config
The text was updated successfully, but these errors were encountered: