Git Product home page Git Product logo

Comments (9)

dthorpe avatar dthorpe commented on August 16, 2024

Thanks for logging this issue. I'll be investigating this in more detail, but my best guess right now is that the swagger.json is failing to download for some reason, and the client sdk isn't handling that case well. Beefing up the error reporting in this area will be my first step.

from looker-sdk-ruby.

cionescu avatar cionescu commented on August 16, 2024

Thanks for this @dthorpe. Do you have any update on this?

from looker-sdk-ruby.

dthorpe avatar dthorpe commented on August 16, 2024

@cionescu

HTTP 500 Server Error is not an error to be expected from login or swagger.json. Please check the Looker instance's admin logs for 500 Server Error log entries. These log entries should contain stack traces. If you find such entries in the logs, please copy them into a message here to help me better understand what's failing.

I've added some diagnostic messages to the client sdk in this PR: #83
If you could pull that branch to your local disk and try running your code using this modified sdk, please let me know if you see error messages reported by the client sdk for try_load_swagger. Again, for any API error response seen on the client there should be a corresponding entry in the Looker admin logs, and a copy of those would be very helpful.

Thanks,
-Danny

from looker-sdk-ruby.

dthorpe avatar dthorpe commented on August 16, 2024

@cionescu
Do you ever set sdk.shared_swagger to true? It defaults to false. When set to true, it changes the way the client loads the swagger metadata.

from looker-sdk-ruby.

cionescu avatar cionescu commented on August 16, 2024

Hi @dthorpe. Thanks for looking into this.

  1. I am not sure how to check the Looker instance admin logs.
  2. Do you have any idea when will your PR make it into a new gem release? I'd like to upgrade our client and perhaps monitor our application logs for that message
  3. I never set the shared_swagger config, so I'm assuming it's still false. An overview of the way I'm using the client is:
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
# ... and then ..
client.run_inline_query("json", query).map(&:to_h) 

from looker-sdk-ruby.

dthorpe avatar dthorpe commented on August 16, 2024

Hi @cionescu thanks for the follow-up. Your code looks fine.

The Looker instance admin logs can be found in the Looker web app under the Admin menu. Scroll all the way to the bottom and select Log, under the Server section header. If you don't have admin rights, ask your Looker admin to view the log with you. It will help to have the log window open while you run your API script.

from looker-sdk-ruby.

cionescu avatar cionescu commented on August 16, 2024

@dthorpe did you make any progress with this?

from looker-sdk-ruby.

OAuthBringer avatar OAuthBringer commented on August 16, 2024

I'm working with the looker-sdk right now and am writing out specs for an implementation that configures users, groups, and permissions for use with embedding.

What I can say in the little time I've been using the SDK is that the no_method_error can be caused by a few things including failure to connect to the looker host. If the host is not available you can still initialize the client, but that doesn't mean your connection was successful.

If you try to execute a dynamically created method with a bad host connection it will fail to load the swagger json and throw the no_method_error.

One suggestion I have is to try testing the host connection before running your dynamic method. i.e. sdk.client.alive should return a 200 if it is available.

I would advocate for better error handling overall as no_method_error simply implies that a swagger.json file has not been loaded.

from looker-sdk-ruby.

dsoegijono avatar dsoegijono commented on August 16, 2024

I'm seeing this error as well, when I think it should be an Unauthorized error (return by sdk.last_error)

2.5.3 :018 > sdk.update_session({ workspace_id: 'dev' })
Traceback (most recent call last):
        7: from /Users/daphne/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
        6: from /Users/daphne/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
        5: from /Users/daphne/.rvm/gems/ruby-2.5.3/bin/irb:23:in `<main>'
        4: from /Users/daphne/.rvm/gems/ruby-2.5.3/bin/irb:23:in `load'
        3: from /Users/daphne/.rvm/gems/ruby-2.5.3/gems/irb-1.2.7/exe/irb:11:in `<top (required)>'
        2: from (irb):18
        1: from /Users/daphne/.rvm/gems/ruby-2.5.3/gems/looker-sdk-0.0.7/lib/looker-sdk/client/dynamic.rb:105:in `method_missing'
NoMethodError (undefined method `update_session' for #<LookerSDK::Client:0x00007fb14619a5d8>)
2.5.3 :019 > sdk.last_error
 => #<LookerSDK::Unauthorized: GET https://mycompany.looker.com/api/3.0/swagger.json: 401 - Error: Unauthorized>

sdk.alive returns 200

from looker-sdk-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.