Environment
- react-native-appwrite 0.32.0 (the upload code is the same in 0.34.0)
- expo ~57.0.18, react-native 0.86.3, Android device, new architecture
- Appwrite Cloud
What happens
await storage.createFile({
bucketId,
fileId: ID.unique(),
file: { name: pdf.name, type: 'application/pdf', size: pdf.size, uri: pdf.uri },
permissions: [Permission.read(Role.user(userId))],
});
rejects with an AppwriteException whose message is Unsupported FormDataPart implementation (code 0, type empty). No request reaches Appwrite. The uri is a file:// path in the app cache returned by expo-document-picker.
Why
Expo SDK 57 installs expo/fetch as the global fetch on native (expo/src/winter/runtime.native.ts; the opt-out is EXPO_PUBLIC_USE_RN_FETCH=1). Its multipart encoder, expo/src/winter/fetch/convertFormData.ts, accepts string parts, Blob parts and objects exposing bytes(), and throws Unsupported FormDataPart implementation for anything else. Its own header comment states that uri is not supported for React Native's FormData.
Client.call appends the file to a React Native FormData as { uri, name, type } (dist/esm/sdk.js, the multipart/form-data branch around line 610). The chunked path for files above 5 MB does the same with a data: URI on iOS and a temp file on Android (around line 4200). Both shapes now throw before the request is sent.
Workaround
Set EXPO_PUBLIC_USE_RN_FETCH=1 so Expo keeps React Native's fetch, which understands { uri } parts.
Suggested fix
The SDK already depends on expo-file-system. Building the part from new File(uri) (it exposes bytes(), name, type and size) or from a Blob would work under both fetch implementations. Related: #112 covers the removed legacy FileSystem import on SDK 55.
Environment
What happens
rejects with an
AppwriteExceptionwhose message isUnsupported FormDataPart implementation(code 0, type empty). No request reaches Appwrite. Theuriis afile://path in the app cache returned byexpo-document-picker.Why
Expo SDK 57 installs
expo/fetchas the globalfetchon native (expo/src/winter/runtime.native.ts; the opt-out isEXPO_PUBLIC_USE_RN_FETCH=1). Its multipart encoder,expo/src/winter/fetch/convertFormData.ts, accepts string parts,Blobparts and objects exposingbytes(), and throwsUnsupported FormDataPart implementationfor anything else. Its own header comment states thaturiis not supported for React Native's FormData.Client.callappends the file to a React NativeFormDataas{ uri, name, type }(dist/esm/sdk.js, themultipart/form-databranch around line 610). The chunked path for files above 5 MB does the same with adata:URI on iOS and a temp file on Android (around line 4200). Both shapes now throw before the request is sent.Workaround
Set
EXPO_PUBLIC_USE_RN_FETCH=1so Expo keeps React Native's fetch, which understands{ uri }parts.Suggested fix
The SDK already depends on
expo-file-system. Building the part fromnew File(uri)(it exposesbytes(),name,typeandsize) or from aBlobwould work under both fetch implementations. Related: #112 covers the removed legacy FileSystem import on SDK 55.