Bun integration test is flakey, possibly due to bug in `stream` implementation
The integration test for Bun fails sporadically with a timeout. Re-running usually results in a successful run.
For example, here's a run that failed: https://github.com/replicate/replicate-javascript/actions/runs/8340326500/job/22824063223
And here's the retry, which succeeded: https://github.com/replicate/replicate-javascript/actions/runs/8340326500/job/22824613649
What's concerning is that both predictions succeeded:
- First: https://replicate.com/p/n2h3hilb7s55wccy5f4qif53z4
- Second: https://replicate.com/p/qvsajjdbhkhfr2zlgdxziae4ja
This makes me think that the flakiness is actually a problem in our streaming code. And if we aren't seeing this with the other integration tests, then that suggests a problem in our TextDecoderStream polyfill.
@aron Any ideas why we're seeing this?
Not sure. There's not much to that TextDecoderStream polyfill we added. Could it also be something to do with the Bun fetch/Response implementation…? We'd have to add more profiling/debugging information to the bun test I think to understand where in the code it's timing out.
I haven't observed this test flakiness recently — in fact, working on #281, I noticed that Bun was the only integration test that didn't occasionally fail with a 503 error. Switching everything to replicate/canary in #283 should stop this from happening in the future.