dblock / slack-strava

(Re)Post Strava activities to Slack
https://slava.playplay.io
MIT License
38 stars 6 forks source link

Maps aren't showing, both full/thumbs #96

Closed igordebatur closed 4 years ago

igordebatur commented 4 years ago

The screenshots are attached.

slack_bP0D4ky3Sk slack_yblAOU7Sk4

dblock commented 4 years ago

This was reported before on some Slacks, and seems to be something with Slack itself or possibly a team configuration. Was not able to find what it is, see #3. Had reached out to Slack about this and wasn't able to get anything conclusive.

This is what the bot posts:

{"attachments":[{"fallback":"Morning Ride via \u003c@U9550BZ9N\u003e, 9.69km 35m37s 3m41s/km","title":"Morning Ride","title_link":"https://www.strava.com/activities/3691708182","text":"\u003c@rsedykh171\u003e on Tuesday, June 30, 2020 at 10:34 AM","image_url":"https://slava.playplay.io/api/maps/5efaff3d934594010993ba24.png","fields":[{"title":"Type","value":"Ride 🚴","short":true},{"title":"Distance","value":"9.69km","short":true},{"title":"Moving Time","value":"35m37s","short":true},{"title":"Elapsed Time","value":"1h25m33s","short":true},{"title":"Pace","value":"3m41s/km","short":true},{"title":"Speed","value":"16.3km/h","short":true},{"title":"Elevation","value":"94.1m","short":true},{"title":"Max Speed","value":"63.0km/h","short":true},{"title":"Weather","value":"21°C Rain","short":true}],"author_name":"Roman Sedykh","author_link":"https://www.strava.com/athletes/roman_sedykh","author_icon":"https://graph.facebook.com/10157224345431795/picture?height=256\u0026width=256"}],"channel":"C0159LUJNBG","as_user":true}

You can see that the map is in there.

dblock commented 4 years ago

Also check out message builder that renders this correctly.

Screen Shot 2020-06-30 at 9 17 19 AM
dblock commented 4 years ago

I opened another support request, https://dblockdotorg.slack.com/help/requests/2973315

dblock commented 4 years ago

@igordebatur Slack advises to first check whether the URLs are blocked, https://slack.com/help/articles/360001502048-Manage-link-previews-for-your-workspace#view-a-list-of-blocked-previews

Is there a channel I can send lots of messages to? The other thing they are suggesting is to send a whole load (1 per second for a long time) and see if any render at all or whether it's consistently none.

igordebatur commented 4 years ago

I checked, none of potentially relevant URLs are blocked:

Screenshot 2020-07-01 at 11 53 41

I created the "test-slava" channel and invited @slava , you can send any number of messages there, thx!

Slava commented 4 years ago

I can't express how much frustration the naming of this chat bot brought to me in my work, and now GitHub notifications.

dblock commented 4 years ago

I can't express how much frustration the naming of this chat bot brought to me in my work, and now GitHub notifications.

😢 сори, I feel your pain, I used to be "db" in slack

I wish Slack allowed renaming bots in teams or Strava allowed to create a bot with "strava" in the name.

Slava commented 4 years ago

@dblock all good, my coworkers had a lot of fun with the bot. I got accidentally tagged in some of the runners/bikers channels but it is not as bad as my first comment might have made it seem.

image

dblock commented 4 years ago

@dblock all good, my coworkers had a lot of fun with the bot. I got accidentally tagged in some of the runners/bikers channels but it is not as bad as my first comment might have made it seem.

image

Haha, can I post this on Twitter or RT someone?

dblock commented 4 years ago

This one rendered:

I, [2020-07-06T17:04:38.637212 #18808]  INFO -- : Skipping user_id=U02BWGK6S, user_name=dm, name=Afternoon Ride , date=Monday, July 06, 2020 at 05:51 PM, distance=30.22km, moving time=1h10s, pace=1m59s/km, proxy=https://slava.playplay.io/api/maps/5f0359a693459449782f8526.png, png=109197 byte(s), private.
I, [2020-07-06T17:08:25.177402 #18808]  INFO -- : Rebragging about user_id=U02BWGK6S, user_name=dm, name=Afternoon Ride , date=Monday, July 06, 2020 at 05:51 PM, distance=30.22km, moving time=1h10s, pace=1m59s/km, proxy=https://slava.playplay.io/api/maps/5f0359a693459449782f8526.png, png=109197 byte(s).
I, [2020-07-06T17:18:47.138117 #18808]  INFO -- : Bragging about user_id=U02BWGK6S, user_name=dm, name=Afternoon Workout, date=Monday, July 06, 2020 at 05:51 PM, distance=30.22km, moving time=1h10s, pace=1m59s/km, proxy=https://slava.playplay.io/api/maps/5f0359a693459449782f8526.png, png=109197 byte(s).
I, [2020-07-06T17:18:47.340238 #18808]  INFO -- : Posting '{"attachments":[{"fallback":"Afternoon Workout via \u003c@U02BWGK6S\u003e, 30.22km 1h10s 1m59s/km","title":"Afternoon Workout","title_link":"https://www.strava.com/activities/3722702171","text":"\u003c@dm\u003e on Monday, July 06, 2020 at 05:51 PM\n\nPartly Cloudy, 17°C, Feels like 17°C, Humidity 64%, Wind 6m/s from WNW - by Klimat.app","image_url":"https://slava.playplay.io/api/maps/5f0359a693459449782f8526.png","fields":[{"title":"Type","value":"Ride 🚴","short":true},{"title":"Distance","value":"30.22km","short":true},{"title":"Moving Time","value":"1h10s","short":true},{"title":"Elapsed Time","value":"1h5m31s","short":true},{"title":"Pace","value":"1m59s/km","short":true},{"title":"Speed","value":"30.1km/h","short":true},{"title":"Elevation","value":"29m","short":true},{"title":"Max Speed","value":"38.9km/h","short":true},{"title":"Heart Rate","value":"149.7bpm","short":true},{"title":"Max Heart Rate","value":"172.0bpm","short":true},{"title":"PR Count","value":"13","short":true},{"title":"Weather","value":"16°C Clouds","short":true}],"author_name":"Dmitry Mukhin","author_link":"https://www.strava.com/athletes/dmukhin","author_icon":"https://lh3.googleusercontent.com/a-/AOh14Gi35Obte0OWZZDBoiqf0L5yMtVJBDLHM-vO1wq5z-k"}],"channel":"C0159LUJNBG","as_user":true}' to name=Uploadcare, id=T02BWGAM4 on #cycling.
D, [2020-07-06T17:18:58.506243 #18808] DEBUG -- : Getting map ID 5f0359a693459449782f8526.
D, [2020-07-06T17:18:58.646541 #18808] DEBUG -- : Found activity ID 5f0359a693459449782f8526 with URL https://slava.playplay.io/api/maps/5f0359a693459449782f8526.png.
D, [2020-07-06T17:18:58.647022 #18808] DEBUG -- : Returning 109197 byte(s) of PNG for activity ID 5f0359a693459449782f8526.
I, [2020-07-06T19:56:17.790508 #18808]  INFO -- : Rebragging about user_id=U02BWGK6S, user_name=dm, name=Afternoon Workout, date=Monday, July 06, 2020 at 05:51 PM, distance=30.22km, moving time=1h10s, pace=1m59s/km, proxy=https://slava.playplay.io/api/maps/5f0359a693459449782f8526.png, png=109197 byte(s).
I, [2020-07-06T19:56:17.794496 #18808]  INFO -- : Updating '{"attachments":[{"fallback":"Afternoon Workout via \u003c@U02BWGK6S\u003e, 30.22km 1h10s 1m59s/km","title":"Afternoon Workout","title_link":"https://www.strava.com/activities/3722702171","text":"\u003c@dm\u003e on Monday, July 06, 2020 at 05:51 PM\n\nPartly Cloudy, 17°C, Feels like 17°C, Humidity 64%, Wind 6m/s from WNW - by Klimat.app\r\n-- myWindsock Report --\r\nWeather Impact: 4.3%\r\nHeadwind: 53% @ 5.6-9.6m/s\r\nLongest Headwind: 11m 22s\r\nAir Speed: 30.7km/h\r\nTemp: 16.8-16.9°C\r\nPrecip: 8% @ 0.11 Inch/hr\r\n-- END --","image_url":"https://slava.playplay.io/api/maps/5f0359a693459449782f8526.png","fields":[{"title":"Type","value":"Ride 🚴","short":true},{"title":"Distance","value":"30.22km","short":true},{"title":"Moving Time","value":"1h10s","short":true},{"title":"Elapsed Time","value":"1h5m31s","short":true},{"title":"Pace","value":"1m59s/km","short":true},{"title":"Speed","value":"30.1km/h","short":true},{"title":"Elevation","value":"29m","short":true},{"title":"Max Speed","value":"38.9km/h","short":true},{"title":"Heart Rate","value":"149.7bpm","short":true},{"title":"Max Heart Rate","value":"172.0bpm","short":true},{"title":"PR Count","value":"13","short":true},{"title":"Weather","value":"16°C Clouds","short":true}],"author_name":"Dmitry Mukhin","author_link":"https://www.strava.com/athletes/dmukhin","author_icon":"https://lh3.googleusercontent.com/a-/AOh14Gi35Obte0OWZZDBoiqf0L5yMtVJBDLHM-vO1wq5z-k"}],"channel":"C0159LUJNBG","ts":"1594055938.046000","as_user":true}' to name=Uploadcare, id=T02BWGAM4 on #C0159LUJNBG.
D, [2020-07-06T19:56:17.923132 #18808] DEBUG -- : Getting map ID 5f0359a693459449782f8526.
D, [2020-07-06T19:56:18.078480 #18808] DEBUG -- : Found activity ID 5f0359a693459449782f8526 with URL https://slava.playplay.io/api/maps/5f0359a693459449782f8526.png.
D, [2020-07-06T19:56:18.078705 #18808] DEBUG -- : Returning 109197 byte(s) of PNG for activity ID 5f0359a693459449782f8526.
dblock commented 4 years ago

Map endpoint P99 is 142ms. Added an index to map._id in https://github.com/dblock/slack-strava/commit/eaff25c5e6e8bae63fa8100fb6adcc47bb14b596.

dblock commented 4 years ago

I was able to reproduce on a personal test Slack.

1) First chat_postMessage did not render the image. I see a request from Slackbot 1.0 (+https://api.slack.com/robots) a few ms after the post though that returned the PNG. The PNG is cached and is definitely correct.

2) At some point I see a request from Slack-ImgProxy (+https://api.slack.com/robots).

2) Subsequent chat_postMessage rendered the image (screenshot, second post). Same robots request.

3) A chat_update to the message without any changes re-renders the image in the original post. Same robots request.

dblock commented 4 years ago

Looks like swapping Puma for Unicorn resolved this? https://github.com/dblock/slack-strava/commit/207f1a215032a81097b5c01488cfc03fe3832193

dblock commented 2 months ago

In https://github.com/dblock/slack-strava/commit/949c96b69092af728b58700ab234e7f91b48819d and https://github.com/dblock/slack-strava/commit/1325e727891a38f4f27d84d065904df7af380d00 I added a bool to re-experiment with a redirect to a map. It has been a few months without problems, today all teams in production were set to have proxy_maps = false. If you have a map problem please comment on this issue.