looker / lookerbot

Lookerbot lets you access all your Looker data from Slack! Super fun!
https://looker.com/lookerbot
MIT License
169 stars 141 forks source link

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

Open michael-erasmus opened 7 years ago

michael-erasmus commented 7 years ago

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?

wilg commented 7 years ago

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

michael-erasmus commented 7 years ago

@wilg yep!

wilg commented 7 years ago

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?

michael-erasmus commented 7 years ago

@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

wilg commented 7 years ago

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.)

michael-erasmus commented 7 years ago

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.

wilg commented 7 years ago

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

michael-erasmus commented 7 years ago

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

wilg commented 7 years ago

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).