18

I ran bundler update on my rails 6 project and now see the following deprecation notice when I run rails console. Anyone know off hand which is the offending combo of incompatible gem/ruby version?

Deprecation Notice:

root@1ddbacaf4a69:/app# bin/rails c
Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead!
Top level ::Parts is deprecated, require 'multipart/post' and use `Multipart::Post::Parts` instead!

Ruby version: 3.1.2

Google and github has not been too much help. I don't want to start disabling gems one at a time to figure it out.

PressingOnAlways
  • 11,948
  • 6
  • 32
  • 59

1 Answers1

21

UPDATE:

TLDR; this error is most commonly caused by faraday-multipart dependency on multipart-post. faraday-multipart has released a fix for this - simply upgrading the gem to 1.0.4 or newer should resolve this issue.

================

Further digging, I found the offending piece of code:

multipart-post/lib/composite_io.rb:

warn "Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead!"

Which is being used by:

Gemfile.lock:

    faraday (1.10.0)
      faraday-em_http (~> 1.0)
      faraday-em_synchrony (~> 1.0)
      faraday-excon (~> 1.1)
      faraday-httpclient (~> 1.0)
      faraday-multipart (~> 1.0)
    ...
    faraday-multipart (1.0.3)
      multipart-post (>= 1.2, < 3)

Which leads me to this issue: https://github.com/lostisland/faraday-multipart/issues/5

Bottom line answer - there is a fix for this which should be merged and released in a few days. bundle update again and this should go away when faraday libraries are updated.

PressingOnAlways
  • 11,948
  • 6
  • 32
  • 59
  • 2
    It's merged already https://github.com/lostisland/faraday-multipart/pull/6 – djserva Jun 07 '22 at 14:10
  • 2
    I confirm it's fixed in `faraday-multipart` `1.0.4` – jibai31 Jun 09 '22 at 17:46
  • 2
    Thanks, `bundle update faraday-multipart` slightly increased my sanity! :) – Asherah Jun 14 '22 at 04:22
  • Doesn't work for me, unfortunately. I get the notification because the gem `twitter` uses `multipart-post`. I updated `twitter` to its newest version and according to Gemfile.lock I now use multipart-post in Version 2.2.3. Still the deprecation warning. (Rails 5.2.8, Ruby 2.4.2, `twitter` v. 7.0) – MDickten Jun 23 '22 at 12:11
  • @MDickten open up an issue on their github - https://github.com/sferik/twitter/issues. – PressingOnAlways Jun 24 '22 at 01:46
  • 1
    @PressingOnAlways I've found out that's not necessary. I had another gem (`koala` v 3.0) using `faraday` and updated `faraday` (from 0.11.0 to 1.10!!) by including it in the Gemfile by itself. I don't really understand it but now the deprecation warnings are gone. So it would appear that another source for this warning could be `koala`. – MDickten Jun 24 '22 at 09:24
  • For me, this answer was close enough: our app is using faraday 0.17.5, which depends on an outdated version of multipart-post directly (no faraday-multipart intermediary). – JakeRobb Dec 22 '22 at 16:47
  • This does not resolve the issue for us as our app has models in a Parts namespace. The deprecation warning occurs "warning: constant ::Parts is deprecated. – vanboom Jan 19 '23 at 14:55