# zendesk_api 1.38.0.rc1 crashes with NoMethodError: undefined method 'key?' on multipart uploads

## The problem

We updated zendesk_api from 1.26 to 1.38.0.rc1 because other dependencies required Faraday >= 2.0. Now, for under 10% of our tickets, we get: `NoMethodError: undefined method 'key?' for #[Faraday::Multipart::CompositeReadIO]` coming from `zendesk_api/middleware/request/upload.rb` in `set_file`. It only happens in production and I cannot reproduce it locally. What causes this?

## The verified fix

This was a real bug in the rc1 release. It triggered when the request payload was large: users whose ticket payloads carried extra data like thumbnail references got a `Faraday::Multipart::CompositeReadIO` instance passed to the upload middleware's `set_file`, which called `key?` on it and crashed. The workaround is to use `_id` suffixed attributes (send ids only, not whole objects) when you have existing records, since the gem is not exactly like ActiveRecord. The actual fix was pushed in the rc2 build, which the maintainer confirmed resolves it. So update to a version containing the rc2 fix, or use the `_ids` workaround if you are pinned to rc1.

Source: https://github.com/zendesk/zendesk_api_client_rb/issues/513