We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8f4c8e6 commit e230496Copy full SHA for e230496
1 file changed
index.js
@@ -211,7 +211,11 @@ class Replicate {
211
const shouldRetry = method === 'GET' ?
212
(response) => (response.status === 429 || response.status >= 500) :
213
(response) => (response.status === 429);
214
- const response = await withAutomaticRetries(async () => this.fetch(url, init), { shouldRetry });
+
215
+ // Workaround to fix `TypeError: Illegal invocation` error in Cloudflare Workers
216
+ // https://github.com/replicate/replicate-javascript/issues/134
217
+ const _fetch = this.fetch; // eslint-disable-line no-underscore-dangle
218
+ const response = await withAutomaticRetries(async () => _fetch(url, init), { shouldRetry });
219
220
if (!response.ok) {
221
const request = new Request(url, init);
0 commit comments