Skip to content
This repository was archived by the owner on Nov 30, 2021. It is now read-only.
This repository was archived by the owner on Nov 30, 2021. It is now read-only.

NoMethodError for LookerSDK::Client #82

Description

@cionescu

Hello,

I noticed some strange behavior with the client sdk.

I am configuring the client as:

  def client
    @_client ||= LookerSDK::Client.new(
      client_id: Settings.looker.client_id,
      client_secret: Settings.looker.client_secret,
      api_endpoint: Settings.looker.api_endpoint,
      connection_options: {
        request: {
          timeout: 360,
          open_timeout: 30,
        },
      },
    )
  end

when using the client, I sometimes get

NoMethodError: undefined method run_inline_query' for #<LookerSDK::Client:0x0000000130cbd0> from looker-sdk/client/dynamic.rb:62:in method_missing'

I have not been able to find a better stack trace for this (even adding breakpoints in your client was not enough to figure this out). I was able to narrow down the failure to this test case:

    it "throws an error" do
      stub_request(:post, /caring.looker.com:19999\/login/).to_return(status: [500, "Internal Server Error"])
      stub_request(:get, /caring.looker.com:19999\/api\/3.0\/swagger.json/).to_return(status: [500, "Internal Server Error"])

      expect {
        client.run_inline_query('json', {})
      }.to raise_exception(NoMethodError)
    end

How should I handle this? My understanding is that a 500 during the login or when fetching swagger.json would make @swagger be nil, propping find_entry(method_name) in dynamic.rb return false. The 500 during either the login or fetching the config json is something to be expected, but I would expect a LookerSDK::ServerError instead of a NoMethodError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions