sentry-ruby
sentry-ruby copied to clipboard
Can't exclude Vips::Error
Issue Description
I have 'Vips::Error' in my excluded_exceptions config, yet I still get it reported.
Reproduction Steps
Add 'Vips::Error' to excluded_exceptions.
Expected Behavior
No reporting of Vips::Error.
Actual Behavior
Yes reporting of Vips::Error. Sample stack trace:
Vips::Error: VipsForeignSave: "/tmp/image_processing20231216-2975659-5nmtf8.jfif" is not a known file format (Vips::Error)
VipsForeignSave: "/tmp/image_processing20231216-2975659-5nmtf8.jfif" is not a known file format
from ruby-vips (2.2.0) lib/vips/image.rb:590:in `write_to_file'
from image_processing (1.12.2) lib/image_processing/vips.rb:63:in `save_image'
from image_processing (1.12.2) lib/image_processing/processor.rb:23:in `call'
from image_processing (1.12.2) lib/image_processing/pipeline.rb:50:in `call_processor'
from image_processing (1.12.2) lib/image_processing/pipeline.rb:28:in `block in call'
from image_processing (1.12.2) lib/image_processing/pipeline.rb:64:in `create_tempfile'
from image_processing (1.12.2) lib/image_processing/pipeline.rb:27:in `call'
from image_processing (1.12.2) lib/image_processing/builder.rb:14:in `block in call!'
from image_processing (1.12.2) lib/image_processing/builder.rb:21:in `instrument'
from image_processing (1.12.2) lib/image_processing/builder.rb:13:in `call!'
from image_processing (1.12.2) lib/image_processing/chainable.rb:60:in `call'
from activestorage (7.0.8) lib/active_storage/transformers/image_processing_transformer.rb:25:in `process'
from activestorage (7.0.8) lib/active_storage/transformers/transformer.rb:22:in `transform'
from activestorage (7.0.8) app/models/active_storage/variation.rb:56:in `block in transform'
from activesupport (7.0.8) lib/active_support/notifications.rb:206:in `block in instrument'
from activesupport (7.0.8) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
from activesupport (7.0.8) lib/active_support/notifications.rb:206:in `instrument'
from activestorage (7.0.8) app/models/active_storage/variation.rb:55:in `transform'
from activestorage (7.0.8) app/models/active_storage/variant_with_record.rb:35:in `block in transform_blob'
from activestorage (7.0.8) lib/active_storage/downloader.rb:15:in `block in open'
from activestorage (7.0.8) lib/active_storage/downloader.rb:24:in `open_tempfile'
from activestorage (7.0.8) lib/active_storage/downloader.rb:12:in `open'
from activestorage (7.0.8) lib/active_storage/service.rb:90:in `open'
from activestorage (7.0.8) app/models/active_storage/blob.rb:301:in `open'
from activestorage (7.0.8) app/models/active_storage/variant_with_record.rb:34:in `transform_blob'
from activestorage (7.0.8) app/models/active_storage/variant_with_record.rb:19:in `process'
from activestorage (7.0.8) app/models/active_storage/variant_with_record.rb:14:in `processed'
from activestorage (7.0.8) app/controllers/active_storage/representations/base_controller.rb:14:in `set_representation'
from activesupport (7.0.8) lib/active_support/callbacks.rb:400:in `block in make_lambda'
from activesupport (7.0.8) lib/active_support/callbacks.rb:199:in `block (2 levels) in halting'
from actionpack (7.0.8) lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
from activesupport (7.0.8) lib/active_support/callbacks.rb:200:in `block in halting'
from activesupport (7.0.8) lib/active_support/callbacks.rb:595:in `block in invoke_before'
from activesupport (7.0.8) lib/active_support/callbacks.rb:595:in `each'
from activesupport (7.0.8) lib/active_support/callbacks.rb:595:in `invoke_before'
from activesupport (7.0.8) lib/active_support/callbacks.rb:116:in `block in run_callbacks'
from actiontext (7.0.8) lib/action_text/rendering.rb:20:in `with_renderer'
from actiontext (7.0.8) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
from activesupport (7.0.8) lib/active_support/callbacks.rb:127:in `instance_exec'
from activesupport (7.0.8) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
from sentry-rails (5.13.0) lib/sentry/rails/controller_transaction.rb:28:in `block in sentry_around_action'
from sentry-ruby (5.13.0) lib/sentry/hub.rb:102:in `with_child_span'
from sentry-ruby (5.13.0) lib/sentry-ruby.rb:476:in `with_child_span'
from sentry-rails (5.13.0) lib/sentry/rails/controller_transaction.rb:14:in `sentry_around_action'
from activesupport (7.0.8) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
from activesupport (7.0.8) lib/active_support/callbacks.rb:138:in `run_callbacks'
from actionpack (7.0.8) lib/abstract_controller/callbacks.rb:233:in `process_action'
from actionpack (7.0.8) lib/action_controller/metal/rescue.rb:23:in `process_action'
from actionpack (7.0.8) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
from activesupport (7.0.8) lib/active_support/notifications.rb:206:in `block in instrument'
from activesupport (7.0.8) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
from activesupport (7.0.8) lib/active_support/notifications.rb:206:in `instrument'
from actionpack (7.0.8) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
from actionpack (7.0.8) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
from activerecord (7.0.8) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
from actionpack (7.0.8) lib/abstract_controller/base.rb:151:in `process'
from actionview (7.0.8) lib/action_view/rendering.rb:39:in `process'
from actionpack (7.0.8) lib/action_controller/metal.rb:188:in `dispatch'
from actionpack (7.0.8) lib/action_controller/metal.rb:251:in `dispatch'
from actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
from actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:32:in `serve'
from actionpack (7.0.8) lib/action_dispatch/journey/router.rb:50:in `block in serve'
from actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `each'
from actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `serve'
from actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:852:in `call'
from omniauth (2.1.1) lib/omniauth/strategy.rb:202:in `call!'
from omniauth (2.1.1) lib/omniauth/strategy.rb:169:in `call'
from omniauth (2.1.1) lib/omniauth/strategy.rb:202:in `call!'
from omniauth (2.1.1) lib/omniauth/strategy.rb:169:in `call'
from omniauth (2.1.1) lib/omniauth/strategy.rb:202:in `call!'
from omniauth (2.1.1) lib/omniauth/strategy.rb:169:in `call'
from omniauth (2.1.1) lib/omniauth/builder.rb:44:in `call'
from rack-attack (6.6.1) lib/rack/attack.rb:127:in `call'
from warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
from warden (1.2.9) lib/warden/manager.rb:34:in `catch'
from warden (1.2.9) lib/warden/manager.rb:34:in `call'
from rack (2.2.8) lib/rack/tempfile_reaper.rb:15:in `call'
from rack (2.2.8) lib/rack/etag.rb:27:in `call'
from rack (2.2.8) lib/rack/conditional_get.rb:27:in `call'
from rack (2.2.8) lib/rack/head.rb:12:in `call'
from actionpack (7.0.8) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
from actionpack (7.0.8) lib/action_dispatch/http/content_security_policy.rb:36:in `call'
from rack (2.2.8) lib/rack/session/abstract/id.rb:266:in `context'
from rack (2.2.8) lib/rack/session/abstract/id.rb:260:in `call'
from actionpack (7.0.8) lib/action_dispatch/middleware/cookies.rb:704:in `call'
from actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
from activesupport (7.0.8) lib/active_support/callbacks.rb:99:in `run_callbacks'
from actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
from sentry-rails (5.13.0) lib/sentry/rails/rescued_exception_interceptor.rb:12:in `call'
from actionpack (7.0.8) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
from sentry-ruby (5.13.0) lib/sentry/rack/capture_exceptions.rb:28:in `block (2 levels) in call'
from sentry-ruby (5.13.0) lib/sentry/hub.rb:251:in `with_session_tracking'
from sentry-ruby (5.13.0) lib/sentry-ruby.rb:387:in `with_session_tracking'
from sentry-ruby (5.13.0) lib/sentry/rack/capture_exceptions.rb:19:in `block in call'
from sentry-ruby (5.13.0) lib/sentry/hub.rb:59:in `with_scope'
from sentry-ruby (5.13.0) lib/sentry-ruby.rb:367:in `with_scope'
from sentry-ruby (5.13.0) lib/sentry/rack/capture_exceptions.rb:18:in `call'
from actionpack (7.0.8) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
from railties (7.0.8) lib/rails/rack/logger.rb:40:in `call_app'
from railties (7.0.8) lib/rails/rack/logger.rb:25:in `block in call'
from activesupport (7.0.8) lib/active_support/tagged_logging.rb:99:in `block in tagged'
from activesupport (7.0.8) lib/active_support/tagged_logging.rb:37:in `tagged'
from activesupport (7.0.8) lib/active_support/tagged_logging.rb:99:in `tagged'
from railties (7.0.8) lib/rails/rack/logger.rb:25:in `call'
from actionpack (7.0.8) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
from actionpack (7.0.8) lib/action_dispatch/middleware/request_id.rb:26:in `call'
from rack (2.2.8) lib/rack/method_override.rb:24:in `call'
from rack (2.2.8) lib/rack/runtime.rb:22:in `call'
from activesupport (7.0.8) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
from actionpack (7.0.8) lib/action_dispatch/middleware/executor.rb:14:in `call'
from rack (2.2.8) lib/rack/sendfile.rb:110:in `call'
from actionpack (7.0.8) lib/action_dispatch/middleware/host_authorization.rb:138:in `call'
from railties (7.0.8) lib/rails/engine.rb:530:in `call'
from puma (6.3.1) lib/puma/configuration.rb:270:in `call'
from puma (6.3.1) lib/puma/request.rb:100:in `block in handle_request'
from puma (6.3.1) lib/puma/thread_pool.rb:344:in `with_force_shutdown'
from puma (6.3.1) lib/puma/request.rb:99:in `handle_request'
from puma (6.3.1) lib/puma/server.rb:443:in `process_client'
from puma (6.3.1) lib/puma/server.rb:245:in `block in run'
from puma (6.3.1) lib/puma/thread_pool.rb:151:in `block in spawn_thread'
Ruby Version
3.2.2
SDK Version
5.13.0
Integration and Its Version
Rails 7.0.8
Sentry Config
Sentry.init do |config|
config.dsn = Rails.application.secrets.sentry_api_key
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
config.excluded_exceptions += ['JSON::ParserError', 'Sidekiq::JobRetry::Skip', 'Sidekiq::Shutdown', 'Puma::HttpParserError', 'ActionDispatch::RemoteIp::IpSpoofAttackError', 'Vips::Error', 'ActiveStorage::FileNotFoundError']
end
@JasonBarnabe can you give me some kind of minimal vips / image_processing function to reproduce the error myself?
I believe this can be caused by uploading an unsupported file type (like JFIF) to Active Storage and then attempting to view a scaled version of the file.
To get the exception from console:
Download a JFIF file, then
require 'vips'
ImageProcessing::Vips::Processor.call(source: '/path/to/sample1.jfif', loader: { page: 0 }, operations: [[:resize_to_limit, [200, 200]]], saver: {}, destination: "/tmp/output.jfif")
/home/jason/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/ruby-vips-2.2.0/lib/vips/image.rb:590:in `write_to_file': VipsForeignSave: "/tmp/output.jfif" is not a known file format (Vips::Error)
VipsForeignSave: "/tmp/output.jfif" is not a known file format