Exception in HostFunction: Malformed calls from JS: field sizes are different
See original GitHub issueI’m trying to upload a JPEG image using react-native-image-picker
which returns me a URI.
When I call RNFetchBlob.fetch() it returns this error
Error
Error: Exception in HostFunction: Malformed calls from JS: field sizes are different. [[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,28,18],[5,4,5,4,4,4,4,4,7,8,8,8,8,8,9,8,9,9,3,11,0],[[673,{"style":{"transform":430,"right":655,"opacity":271},"type":"style"}],[271,673],[655,{"input":[270,20],"op":"multiply","type":"op"}],[270,655],[20,655],[655,673],[430,673],[673,674],[654,277],[653,654],[271,653],[635,653],[270,635],[20,635],[635],[430,653],[653],[654],[674,277],[187,100,1588864064469,false]],3220]
Code / Redux Saga
function* updateAvatar({ payload }) {
if (!payload) {
yield call(api.delete, '/avatar');
yield put(updateAvatarSuccess());
return;
}
const response = yield call(
RNFetchBlob.fetch,
'POST',
`${config.api}/avatar`,
{
'Content-Type': 'multipart/form-data',
...api.defaults.headers,
},
[
{
name: 'file',
filename: 'avatar.jpg',
type: 'image/jpeg',
data: RNFetchBlob.wrap(payload.uri),
},
]
);
yield put(updateAvatarSuccess(response.json().avatar));
I can’t upload files using new FormData()
passing { name: ..., uri: ... }
as many tutorials says, I must send a binary file as this lib does. Thank you.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:5
Top Results From Across the Web
Error: Exception in HostFunction: Malformed calls from JS
As I understand this error can occur in a number of different use cases. Here is what happened in this use case.
Read more >Malformed calls from JS: field sizes are different · Issue #23835
Bug Report Here is the bug I get. Malformed calls from JS: field sizes are different. [[74,24],[19,1],[[64,2000,1552169087432,false]],415] ...
Read more >Explain like I'm 5 - Malformed calls from JS: field sizes ... - Reddit
Explain like I'm 5 - Malformed calls from JS: field sizes are different. When googling this I only see people's github issues -...
Read more >Exception in HostFunction: Malformed calls from JS: field sizes ...
Getting error: LocationError: Exception in HostFunction: Malformed calls from JS: field sizes are different.
Read more >Error: Exception in HostFunction: Malformed calls from JS
Error: Exception in HostFunction: Malformed calls from JS: field sizes are different. [[31,36,36,36],[4,0,1,0],[[3,2000,1630323727880,false] ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I figure out this happens only using
yield call()
of Redux Sagathe solution for me was:
someone know why this happens?
Same issue on android