mrkaye97 / slackr

An R package for sending messages from R to Slack
https://matthewrkaye.com/slackr/
Other
307 stars 83 forks source link

Unable to upload images #172

Closed fbonaita closed 2 years ago

fbonaita commented 2 years ago

Hi,

Since yesterday I've been unable to successfully use ggslackr() or slackr_upload() to upload messages with PNG attachments, and I get the following error message instead:

Error in stop_for_status(resp) : Request Timeout (HTTP 408)

I still can upload images via slackr_dev() but the resolution of the images is too low for my use case. I also tried to use directly files_upload() in combination with ggsave() but it didn't work either. I wonder if something changed on Slack side and call_slack_api() or httr::upload_file() don't work as expected anymore.

mrkaye97 commented 2 years ago

@fbonaita Thanks for the issue. how big is the image your trying to upload? nothing has changed in the package in the past month or so, certainly not since yesterday. I can check into the API, but I highly doubt they made any breaking changes that would break slackr in the past couple days without notifying developers. My guess is that an http 408 (timeout) is being caused by either your internet connection, the size of the image, or a combination of both, but I can look into it more if this issue keeps happening and try to reproduce it on my end. Unlikely that I'll be able to, though.

fbonaita commented 2 years ago

Thanks for the quick reply @mrkaye97.

The images are usually ~2MB so not particularly large and my Internet connection should be able to upload them easily. However, I've just done some tests with highly compressed images and I managed to successfully run slackr_upload() with images smaller than 100KB.

That's interesting since the script I'm running has not significantly changed in the last 2/3 weeks and it used to run smoothly up to last week (with files up to 2MB).

Another odd thing is that when I see slackr_upload() stalling and I interrupt manually the process, the console returns an error as expected while the image ends up being correctly uploaded to Slack (if I don't stop it manually I simply get the request timeout error).

Not sure what to make of all this but at least now I can reduce the image size as workaround if I can't find the root cause.

mrkaye97 commented 2 years ago

Hey @fbonaita -- sorry, just circling back to this. I can't seem to reproduce the issue on my end or in our CI environment, so I'm not sure if I can be much help. If you're having success with smaller images, my hunch is that the issue is your internet connection.

Re: the upload still working -- that's pretty bizarre. One possibility is that this is happening because of a retry calling the Slack API, but again, since I can't reproduce the issue it's tough for me to say. Sorry for not being more help on this :/

fbonaita commented 2 years ago

Hi @mrkaye97,

I haven't been able to find the root cause of the problem in the end but as you suggest it seems likely to be linked to my local setup. I'll soon be deploying the script in a different environment so hopefully this will become a non-issue regardless. I'll close the ticket now but thanks for looking into this and following up.

mrkaye97 commented 2 years ago

Sounds good. Let me know if you have the same issue in the compute environment you deploy to. If you do, that'd be a bad sign