20

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.

1 Answer 1

22

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.

8
  • 2
    It's merged already github.com/lostisland/faraday-multipart/pull/6
    – djserva
    Commented Jun 7, 2022 at 14:10
  • 2
    I confirm it's fixed in faraday-multipart 1.0.4
    – jibai31
    Commented Jun 9, 2022 at 17:46
  • 2
    Thanks, bundle update faraday-multipart slightly increased my sanity! :)
    – Amelia
    Commented Jun 14, 2022 at 4: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
    Commented Jun 23, 2022 at 12:11
  • 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
    Commented Jun 24, 2022 at 9:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.