Closed daisy1754 closed 2 years ago
Hi - this will be added in the next release. Will post in this thread once it's released.
configuration = Plaid::Configuration.new
api_client = Plaid::ApiClient.new(configuration)
api_client.create_connection do |builder|
builder.use Faraday::Response::Logger
end
Just in case you need another example, I believe my team is also blocked on upgrading from v13 to v15 because of this. Here's is our setup:
client = ::Plaid::Client.new(config) do |builder|
# Log responses, which will include the request_id needed by Plaid support.
# This needs to come before the Plaid connection setup below because that will set
# the adapter, which must be the last middleware in Faraday, otherwise it complains.
builder.use :instrumentation, name: 'request.plaid'
::Plaid::Client.build_default_connection(builder)
# Set a custom timeout that may be configured differently between web & background requests.
builder.options[:timeout] = Rails.configuration.x.plaid_request_timeout
end
Hi sorry for the delayed response It looks like the change I mentioned above is live, could you let me know if this works for your use case? To use custom middleware, reinitialize the faraday connection object.
@vorpus Yes the new documentation in the README to use create_connection
worked great for me.
works for me as well, thanks for update
@vorpus maybe provide some more examples similar to that of @ctlevi to help people through the upgrade path
intitialized_client = Plaid::ApiClient.new(configuration)
intitialized_client.create_connection do |builder|
builder.response :logger, logger
end
@client ||= Plaid::PlaidApi.new(intitialized_client)
In our application, we use inhouse faraday middleware called RequestMetricsMiddleware to instrument all outgoing request. It would be great if user of library can use custom middleware like below