lookerbot icon indicating copy to clipboard operation
lookerbot copied to clipboard

Unclear how to debug when scheduled Look is not accessible to bot user

Open michael-erasmus opened this issue 8 years ago • 9 comments

Hi @wilg! I tried setting up Scheduled Looks to go Slack, but seems to have hit a snag without being able to proceed.

I'm pretty sure that I've set up the LOOKER_WEBHOOK_TOKEN correctly, but when I send a test request to the webhook, no message shows up.

I also tried testing by capturing the Looker webhook with my own handler and then mimicking the request with curl, and I get the following response:

{"success":true,"reason":"Sending Look 3513 to channel #data-analytics."}

But no message in Slack. Not sure how to debug further?

michael-erasmus avatar Jan 11 '17 19:01 michael-erasmus

Is the Looker bot user invited to the channel #data-analytics?

wilg avatar Jan 12 '17 18:01 wilg

@wilg yep!

michael-erasmus avatar Jan 13 '17 18:01 michael-erasmus

Strange... There may be additional information in the bot logs. Do you notice any exceptions or error messages in the bot logs (heroku logs --tail if on Heroku) that look suspicious?

wilg avatar Jan 18 '17 21:01 wilg

@wilg thanks for the tip!! We're actually hosting the server ourselves now on Kubernetes, but I was able to check the logs with that and spotted this:

Replied to scheduled plan webhook. { success: true,
  reason: 'Sending Look 1728 to channel @michael.' }
{ message: 'Forbidden',
  documentation_url: 'http://docs.looker.com/' }
Replied to scheduled plan webhook. { success: true,
  reason: 'Sending Look 1728 to channel @michael.' }
Replied to scheduled plan webhook. { success: true,
  reason: 'Sending Look 1728 to channel #data-analytics.' }
{ message: 'Forbidden',
  documentation_url: 'http://docs.looker.com/' }
{ message: 'Forbidden',
  documentation_url: 'http://docs.looker.com/' }

Any idea where that could come from? Could it be when it's trying to access the api on our Looker instance? Not sure if that would be the case, because the @looker bot seems to work fine in our Slack

michael-erasmus avatar Jan 23 '17 19:01 michael-erasmus

Hmm... It's possible the Lookerbot user does not have access to the space or model that the Look requires.

(I wish the error message made clearer what API endpoint the bot is trying to hit.)

wilg avatar Jan 23 '17 20:01 wilg

Hmm... It's possible the Lookerbot user does not have access to the space or model that the Look requires.

@wilg Ah, it seems that was the issue! I was testing with a Look in my personal space and switched to a public Look, which did actually post the message to Slack.

michael-erasmus avatar Jan 23 '17 20:01 michael-erasmus

Great! I'll have to think of a way to make debugging this easier.

wilg avatar Jan 23 '17 20:01 wilg

@wilg Perhaps you could set up a channel or dm to send errors to?

michael-erasmus avatar Jan 23 '17 20:01 michael-erasmus

I think actually the way to do this is that the webhook should wait to respond to Looker until it actually successfully sends the data. If we respond to Looker with a failure, the scheduling system should trigger an email to the user explaining the failure (although this might require some tweaks inside Looker).

wilg avatar Jun 16 '17 00:06 wilg