File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,11 @@ class Replicate {
211211 const shouldRetry = method === 'GET' ?
212212 ( response ) => ( response . status === 429 || response . status >= 500 ) :
213213 ( response ) => ( response . status === 429 ) ;
214- const response = await withAutomaticRetries ( async ( ) => this . fetch ( url , init ) , { shouldRetry } ) ;
214+
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 } ) ;
215219
216220 if ( ! response . ok ) {
217221 const request = new Request ( url , init ) ;
You can’t perform that action at this time.
0 commit comments