Skip to content

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

Closed

Description

@Manfred

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.

Activity

  1. self-assigned this
    on Nov 14, 2017
  2. eli-darkly commented on Dec 21, 2018

    @eli-darkly
    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.

  3. added a commit that references this issue on Jan 17, 2019
  4. eli-darkly commented on Jan 18, 2019

    @eli-darkly
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions