mrkaye97 / slackr

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

slackr_csv() failing to upload dataframes more than 10k rows with Request Timeout (HTTP 408) #198

Closed adrian-pascual closed 11 months ago

adrian-pascual commented 11 months ago

While I've used slackr_csv() for years, yesterday / today it's failing to upload a dataframe with 10k rows or more with the error message Error in stop_for_status(resp) : Request Timeout (HTTP 408). Not sure why it's suddenly failing, I've included a reprex below. Still works fine for a df with 1000 rows.

library(tidyverse)
library(slackr)

slackr_setup()
#> Warning: You're using a user token but also specified the following parameter(s): username. This argument will have no effect.
#> This warning is displayed once per session.
#> [1] "Successfully connected to Slack"
m1 <- matrix(1:1000, ncol = 25, nrow = 10000)
df <- as_tibble(m1)
#> Warning: The `x` argument of `as_tibble.matrix()` must have unique column names if
#> `.name_repair` is omitted as of tibble 2.0.0.
#> ℹ Using compatibility `.name_repair`.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

slackr_csv(df,
  filename = tempfile(pattern = ("test_data"), fileext = ".csv"),
  channels = "data-test"
)
#> Error in stop_for_status(resp): Request Timeout (HTTP 408).
mrkaye97 commented 11 months ago

thanks for filing! does it work with smaller CSV files?

adrian-pascual commented 11 months ago

Yep, tested with 1k rows and it works fine.

mrkaye97 commented 11 months ago

Got it, in that case this is almost certainly not a slackr problem, and is an API problem instead. a couple options might be to split the csv into chunks and upload each chunk, or write as parquet or some other compressed format instead

adrian-pascual commented 11 months ago

I guess Slack must have just updated their API, since I've never had a problem with bigger files before. I'll take a look at trying to compress my CSVs somehow.

mrkaye97 commented 11 months ago

I guess Slack must have just updated their API, since I've never had a problem with bigger files before. I'll take a look at trying to compress my CSVs somehow.

Sounds good. How is your internet connection? that could also cause issues here.

I'm going to close this issue out