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

Encoding::UndefinedConversionError in polling mode when values contain invalid UTF-8 sequences #90

Closed
Manfred opened this issue Aug 15, 2017 · 2 comments

Comments

@Manfred
Copy link

Manfred commented Aug 15, 2017

When the client is running in polling mode and any of the HTTP responses from Launch Darkly contain invalid UTF-8 characters it will throw an exception and return the default value for the variation. In our specific case it's a custom key containing a customer name with "\xE2\x80\x99" (apostrophe) in it somewhere.

Apparently this is a Faraday HTTP cache problem and it was previously mentioned in a PR:
#51 (comment)

Our current workaround is to set the serializer to Marshal:

require 'ldclient-rb/requestor'

module LaunchDarkly
  class Requestor
    def initialize(sdk_key, config)
      @sdk_key = sdk_key
      @config = config
      @client = Faraday.new do |builder|
        builder.use :http_cache, store: @config.cache_store, serializer: Marshal
        builder.adapter :net_http_persistent
      end
    end
  end
end

This problem exists in 2.2.7.

@ashanbrown ashanbrown self-assigned this Nov 14, 2017
@eli-darkly
Copy link
Contributor

Sorry this fell through the cracks. I'm guessing that we haven't heard about it since then because most people are now using streaming mode, but I verified that we do still have this bug in polling mode. The proposed fix does seem effective, but we're still looking at whether it's the right way to go. But in any case we will be rolling out some fix as soon as possible.

eli-darkly added a commit that referenced this issue Jan 17, 2019
numerous Ruby SDK documentation fixes
@eli-darkly
Copy link
Contributor

Finally fixed this in version 5.5.0.

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

3 participants