Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zlib::GzipFile::Error raised on some requests #154

Open
jduarte opened this issue Oct 11, 2019 · 0 comments
Open

Zlib::GzipFile::Error raised on some requests #154

jduarte opened this issue Oct 11, 2019 · 0 comments

Comments

@jduarte
Copy link

jduarte commented Oct 11, 2019

Some API Requests being made through bigcommerce-api-ruby throws a Zlip::Gzip error. Example:

Bigcommerce::Product.all(name: name)

This issue seems to have occurred previously in other projects: restforce#380 , httplog#58 and seems to be related as the a point where the content should still gzipped but it's already unzipped.

On httplog the solution was mostly a check if the content was already unzipped.

Stacktrace

gems/faraday_middleware-0.13.1/lib/faraday_middleware/gzip.rb:60:in `initialize': not in gzip format (Zlib::GzipFile::Error)
    from gems/faraday_middleware-0.13.1/lib/faraday_middleware/gzip.rb:60:in `new'
    from gems/faraday_middleware-0.13.1/lib/faraday_middleware/gzip.rb:60:in `uncompress_gzip'
    from gems/faraday_middleware-0.13.1/lib/faraday_middleware/gzip.rb:52:in `reset_body'
    from gems/faraday_middleware-0.13.1/lib/faraday_middleware/gzip.rb:42:in `block in call'
    from gems/faraday-0.15.4/lib/faraday/response.rb:61:in `on_complete'
    from gems/faraday_middleware-0.13.1/lib/faraday_middleware/gzip.rb:39:in `call'
    from gems/faraday-0.15.4/lib/faraday/response.rb:8:in `call'
    from gems/bigcommerce-1.0.1/lib/bigcommerce/middleware/auth.rb:12:in `call'
    from gems/faraday_middleware-0.13.1/lib/faraday_middleware/request/encode_json.rb:24:in `call'
    from gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'
    from gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'
    from gems/faraday-0.15.4/lib/faraday/connection.rb:138:in `get'
    from gems/bigcommerce-1.0.1/lib/bigcommerce/request.rb:68:in `raw_request'
    from gems/bigcommerce-1.0.1/lib/bigcommerce/request.rb:47:in `get'
    from gems/bigcommerce-1.0.1/lib/bigcommerce/subresource_actions.rb:14:in `all'
    from app/service_objects/big_commerce/api/product_images.rb:7:in `block in all'
    from app/service_objects/big_commerce/api/credentials.rb:24:in `with_connection'
    from app/service_objects/big_commerce/api/product_images.rb:6:in `all'
    from app/service_objects/big_commerce/connector/pipeline_stages/multiple_request_generator.rb:60:in `delete_image_request_generators'
    from app/service_objects/big_commerce/connector/pipeline_stages/multiple_request_generator.rb:20:in `process'
    from app/service_objects/base/connector/pipeline_stages/stage.rb:101:in `block in deprecated_process'
    from app/service_objects/base/connector/pipeline_stages/stage.rb:44:in `run'
    from app/service_objects/base/connector/product_batch_processor.rb:253:in `generate_request'
    from gems/contracts-0.16.0/lib/contracts/method_reference.rb:43:in `send_to'
    from gems/contracts-0.16.0/lib/contracts/call_with.rb:79:in `call_with'
    from gems/contracts-0.16.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
    from app/service_objects/base/connector/product_batch_processor.rb:94:in `block (2 levels) in process_batch'
    from app/service_objects/base/connector/product_batch_processor.rb:77:in `each'
    from app/service_objects/base/connector/product_batch_processor.rb:77:in `each_slice'
    from app/service_objects/base/connector/product_batch_processor.rb:77:in `each_with_index'
    from app/service_objects/base/connector/product_batch_processor.rb:77:in `block in process_batch'
    from app/service_objects/base/connector/base_batch_handler.rb:88:in `with_downloaded_products'
    from app/service_objects/base/connector/product_batch_processor.rb:70:in `process_batch'
    from app/service_objects/base/connector/product_batch_processor.rb:61:in `run_pipeline'
    from app/service_objects/base/connector/product_batch_processor.rb:51:in `block (2 levels) in process'
    from gems/carrot-connector-2.2.1/lib/carrot-connector/carrot_logger.rb:31:in `with_context'
    from gems/carrot-connector-2.2.1/lib/carrot-connector/carrot_logger.rb:69:in `block (2 levels) in define_proxy_methods'
    from app/service_objects/base/connector/product_batch_processor.rb:50:in `block in process'
    from lib/side_effect_manager.rb:9:in `with_policy'
    from app/service_objects/base/connector/base_batch_handler.rb:73:in `with_side_effect_policy'
    from app/service_objects/base/connector/product_batch_processor.rb:49:in `process'
    from gems/carrot-connector-2.2.1/lib/carrot-connector/batch_handler.rb:22:in `full_process'
    from app/service_objects/base/connector/build_and_process_job.rb:8:in `perform'
    from gems/delayed_job-4.1.5/lib/delayed/backend/base.rb:81:in `block in invoke_job'
    from gems/delayed-job-extensions-0.28.4/lib/delayed/extensions/metrics_reporter_plugin.rb:50:in `block (2 levels) in <class:MetricsReporterPlugin>'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
    from gems/delayed-job-extensions-0.28.4/lib/delayed/extensions/exception_reporter_plugin.rb:9:in `block (2 levels) in <class:ExceptionReporterPlugin>'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block in add'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block in add'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
    from gems/delayed_job-4.1.5/lib/delayed/backend/base.rb:78:in `invoke_job'
    from gems/newrelic_rpm-5.1.0.344/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb:129:in `block in invoke_job'
    from gems/newrelic_rpm-5.1.0.344/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:369:in `perform_action_with_newrelic_trace'
    from gems/newrelic_rpm-5.1.0.344/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb:128:in `invoke_job'
    from gems/delayed-job-extensions-0.28.4/lib/delayed/extensions/worker_exception_handling.rb:30:in `block (2 levels) in run'
    from /usr/local/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
    from /usr/local/lib/ruby/2.6.0/timeout.rb:103:in `timeout'
    from gems/delayed-job-extensions-0.28.4/lib/delayed/extensions/worker_exception_handling.rb:30:in `block in run'
    from /usr/local/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
    from gems/delayed-job-extensions-0.28.4/lib/delayed/extensions/worker_exception_handling.rb:29:in `run'
    from gems/delayed-job-extensions-0.28.4/lib/delayed/extensions/worker_exception_handling.rb:9:in `block in reserve_and_run_one_job'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
    from gems/delayed-job-extensions-0.28.4/lib/delayed/extensions/worker_exception_handling.rb:9:in `reserve_and_run_one_job'
    from gems/delayed_job-4.1.5/lib/delayed/worker.rb:213:in `block in work_off'
    from gems/delayed_job-4.1.5/lib/delayed/worker.rb:212:in `times'
    from gems/delayed_job-4.1.5/lib/delayed/worker.rb:212:in `work_off'
    from gems/delayed_job-4.1.5/lib/delayed/worker.rb:175:in `block (4 levels) in start'
    from /usr/local/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
    from gems/delayed_job-4.1.5/lib/delayed/worker.rb:174:in `block (3 levels) in start'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
    from gems/delayed_job-4.1.5/lib/delayed/worker.rb:173:in `block (2 levels) in start'
    from gems/delayed_job-4.1.5/lib/delayed/worker.rb:172:in `loop'
    from gems/delayed_job-4.1.5/lib/delayed/worker.rb:172:in `block in start'
    from gems/delayed_job-4.1.5/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block in add'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
    from gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
    from gems/delayed_job-4.1.5/lib/delayed/worker.rb:171:in `start'
    from gems/delayed_job-4.1.5/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>'
    from gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
    from gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
    from gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
    from gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
    from /usr/local/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
    from gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
    from gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
    from gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
    from gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
    from gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
    from gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
    from gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
    from gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
    from gems/rake-12.3.2/lib/rake/application.rb:83:in `block in run'
    from gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
    from gems/rake-12.3.2/lib/rake/application.rb:80:in `run'
    from gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
    from bin/rake:23:in `load'
    from bin/rake:23:in `<top (required)>'
    from gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `load'
    from gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
    from gems/bundler-2.0.2/lib/bundler/cli/exec.rb:28:in `run'
    from gems/bundler-2.0.2/lib/bundler/cli.rb:465:in `exec'
    from gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    from gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
    from gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
    from gems/bundler-2.0.2/lib/bundler/cli.rb:27:in `dispatch'
    from gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
    from gems/bundler-2.0.2/lib/bundler/cli.rb:18:in `start'
    from gems/bundler-2.0.2/exe/bundle:30:in `block in <top (required)>'
    from gems/bundler-2.0.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
    from gems/bundler-2.0.2/exe/bundle:22:in `<top (required)>'
    from bin/bundle:23:in `load'
    from bin/bundle:23:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant