@ai-sdk/provider-utils
Advanced tools
+6
-0
| # @ai-sdk/provider-utils | ||
| ## 4.0.10 | ||
| ### Patch Changes | ||
| - 462ad00: fix(provider-utils): recognize bun fetch errors as retryable | ||
| ## 4.0.9 | ||
@@ -4,0 +10,0 @@ |
+1
-1
| { | ||
| "name": "@ai-sdk/provider-utils", | ||
| "version": "4.0.9", | ||
| "version": "4.0.10", | ||
| "license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -6,2 +6,25 @@ import { APICallError } from '@ai-sdk/provider'; | ||
| const BUN_ERROR_CODES = [ | ||
| 'ConnectionRefused', | ||
| 'ConnectionClosed', | ||
| 'FailedToOpenSocket', | ||
| 'ECONNRESET', | ||
| 'ECONNREFUSED', | ||
| 'ETIMEDOUT', | ||
| 'EPIPE', | ||
| ]; | ||
| function isBunNetworkError(error: unknown): error is Error & { code?: string } { | ||
| if (!(error instanceof Error)) { | ||
| return false; | ||
| } | ||
| const code = (error as any).code; | ||
| if (typeof code === 'string' && BUN_ERROR_CODES.includes(code)) { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| export function handleFetchError({ | ||
@@ -39,3 +62,13 @@ error, | ||
| if (isBunNetworkError(error)) { | ||
| return new APICallError({ | ||
| message: `Cannot connect to API: ${error.message}`, | ||
| cause: error, | ||
| url, | ||
| requestBodyValues, | ||
| isRetryable: true, | ||
| }); | ||
| } | ||
| return error; | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
809418
0.52%11336
0.75%