O 将我的 Ruby on Rails 应用程序配置为使用带错误报告的 Sentry ,但它向我显示此错误:
URI::InvalidURIError: bad URI(is not URI?): 'http://9ba0c50c55c94603a488a55516d5xxx:[email protected]/24'
当我删除 9ba0c50c55c94603a488a55516d5xxx:xxxx6d6468a4cb892140c1f86a9f228@
这部分地址时一切正常,但在 sentry documentation 中是:
Raven.configure do |config|
config.dsn = 'http://public:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1665737564736256736e777b667a733875797b" rel="noreferrer noopener nofollow">[email protected]</a>/project-id'
end
如何解决这个问题?
最佳答案
我使用ENV var
来设置 Sentry DSN
:
# .env
SENTRY_DSN_URL='http://public:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f88b9d9b8a9d8cb89d80999588949dd69b9795" rel="noreferrer noopener nofollow">[email protected]</a>/project-id'
和初始化程序
Raven.configure do |config|
config.dsn = ENV['SENTRY_DSN']
end
这个问题就是引号。要解决这个问题,只需删除它们即可。
# .env
SENTRY_DSN_URL=http://public:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2d5e484e5f48596d48554c405d4148034e4240" rel="noreferrer noopener nofollow">[email protected]</a>/project-id
工作正常。
关于ruby-on-rails - Sentry InvalidURIError 与 DSN url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49137482/