doitintl / gSlack

Get Slack notifications from Google Cloud Platform
https://blog.doit-intl.com/gslack-9391be7c191a
MIT License
72 stars 15 forks source link

Debugging #8

Open cjstone opened 5 years ago

cjstone commented 5 years ago

Hi, gSlack looks like something very useful, but I'm having trouble getting it to work. I've followed the tutorial to a T several times, but nothing is showing Slack nor in the stackdriver logs. Any clues on how I can further troubleshoot things?

Thanks,

--Chris

spark2ignite commented 5 years ago

Hey @cjstone. We have updated the repo and have fixed few bugs. Would you like to try again and let us know if gSlack works for you?

zen commented 5 years ago

I'm having the same problem. I don't have much experience with Firebase projects, any hints how to debug? Project looks sooo cool, but I have hard time getting it to work

zen commented 5 years ago

I'm getting error like this: Rule test error in 'Bucket '${$.resource.labels.bucket_name}' was ${$.protoPayload.methodName==='storage.buckets.create'?'created':'deleted'} at location '${$.resource.labels.location}' by '${$.protoPayload.authenticationInfo.principalEmail}' in project '${$.resource.labels.project_id}'': SyntaxError: Unexpected string

spark2ignite commented 5 years ago

@Dror88 can you please look into this?

Dror88 commented 5 years ago

@zen The error mentions the "test" field, but it looks like the rule "message" is being evaluated instead. Are you sure your firestore doc is according to the example in README.md?

The field "test" should be:

$.protoPayload.serviceName==='storage.googleapis.com' && ( $.protoPayload.methodName==='storage.buckets.create' || $.protoPayload.methodName==='storage.buckets.delete')

This checks that the event service is GCS and the operation is create or delete

And then the field "message" should be:

Bucket '${$.resource.labels.bucket_name}' was ${$.protoPayload.methodName==='storage.buckets.create'?'created':'deleted'} at location '${$.resource.labels.location}' by '${$.protoPayload.authenticationInfo.principalEmail}' in project '${$.resource.labels.project_id}'

Which will be evaluated to the following slack text message:

Bucket 'my-bucket' was deleted at location 'us' by 'user@example.com' in project 'my-gcp-project'
zen commented 5 years ago

Hi,

Thanks, that was obvious, what a bummer. Now I corrected it, created bunch of buckets in different projects but I don't seem to be able to get any notifications. I guess I'm missing something very simple here. Some functions were triggered, I also see the logs in Stackdriver, but no notifications https://www.dropbox.com/s/0ut9p7skue36oj4/Screenshot%202019-04-30%2014.06.32.png?dl=0

Dror88 commented 5 years ago