Hi all,
we have a problem when users are trying to share files. Smaller files work ok, but e.g. MOV with around 130MB is not sent and error description (at the bottom of this post) does not help much, as mentioned fields are present in the message).
We are using:
"@cometchat-pro/react-native-chat": "3.0.0",
"react-native": "~0.63.4",
All testing files below were picked using DocumentPicker “react-native-document-picker”: “^6.1.1”, with the following code:
const res = await DocumentPicker.pick({
type: [DocumentPicker.types.allFiles],
allowMultiSelection: false,
copyTo: "documentDirectory",
});
if (res.length === 0) {
return null;
}
const selectedFile = res[0];
console.log(selectedFile)
const file = {
name: selectedFile.name,
type: selectedFile.type,
uri: selectedFile.fileCopyUri,
};
...
//Cometchat.sendMediaMessage
Testing files
1. 100MB, MP4
{
"receiverId": "e28e352e-44eb-43ff-bdb8-1bce94748c22",
"type": "file",
"receiverType": "user",
"category": "message",
"data": {
"type": "file",
"category": "message",
"name": "Sample-Video-File-For-Testing100MB.MP4",
"file": {
"name": "Sample-Video-File-For-Testing100MB.MP4",
"type": "video/mp4",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/A8CA3183-58F1-4754-823A-DC5253812149/Sample-Video-File-For-Testing100MB.MP4"
},
"url": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/A8CA3183-58F1-4754-823A-DC5253812149/Sample-Video-File-For-Testing100MB.MP4",
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
}
},
"file": {
"name": "Sample-Video-File-For-Testing100MB.MP4",
"type": "video/mp4",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/A8CA3183-58F1-4754-823A-DC5253812149/Sample-Video-File-For-Testing100MB.MP4"
},
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
},
"receiver": "user",
"conversationId": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1_user_e28e352e-44eb-43ff-bdb8-1bce94748c22",
"_composedAt": 1639734670,
"_id": "_x76gjf7ph"
}
== sent, ok
2. 7MB, MOV
{
"receiverId": "e28e352e-44eb-43ff-bdb8-1bce94748c22",
"type": "file",
"receiverType": "user",
"category": "message",
"data": {
"type": "file",
"category": "message",
"name": "sample_3840x2160_480P_7MB.MOV",
"file": {
"name": "sample_3840x2160_480P_7MB.MOV",
"type": "video/quicktime",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/2FC38599-9DE3-4996-BE43-0814A9822D94/sample_3840x2160_480P_7MB.MOV"
},
"url": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/2FC38599-9DE3-4996-BE43-0814A9822D94/sample_3840x2160_480P_7MB.MOV",
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
}
},
"file": {
"name": "sample_3840x2160_480P_7MB.MOV",
"type": "video/quicktime",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/2FC38599-9DE3-4996-BE43-0814A9822D94/sample_3840x2160_480P_7MB.MOV"
},
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
},
"receiver": "user",
"conversationId": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1_user_e28e352e-44eb-43ff-bdb8-1bce94748c22",
"_composedAt": 1639734975,
"_id": "_drgytou6r"
}'
== sent, OK
3. 23 MB, MOV
{
"receiverId": "e28e352e-44eb-43ff-bdb8-1bce94748c22",
"type": "file",
"receiverType": "user",
"category": "message",
"data": {
"type": "file",
"category": "message",
"name": "sample_3840x2160_720p_23MB.MOV",
"file": {
"name": "sample_3840x2160_720p_23MB.MOV",
"type": "video/quicktime",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/82393115-32B1-4A83-8ADD-4788F8EB998D/sample_3840x2160_720p_23MB.MOV"
},
"url": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/82393115-32B1-4A83-8ADD-4788F8EB998D/sample_3840x2160_720p_23MB.MOV",
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
}
},
"file": {
"name": "sample_3840x2160_720p_23MB.MOV",
"type": "video/quicktime",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/82393115-32B1-4A83-8ADD-4788F8EB998D/sample_3840x2160_720p_23MB.MOV"
},
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
},
"receiver": "user",
"conversationId": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1_user_e28e352e-44eb-43ff-bdb8-1bce94748c22",
"_composedAt": 1639735094,
"_id": "_hiedvd85u"
}
== sent, OK
4. 33 MB, MOV
{
"receiverId": "e28e352e-44eb-43ff-bdb8-1bce94748c22",
"type": "file",
"receiverType": "user",
"category": "message",
"data": {
"type": "file",
"category": "message",
"name": "sample_3840x2160_1080_33MB.MOV",
"file": {
"name": "sample_3840x2160_1080_33MB.MOV",
"type": "video/quicktime",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/8A5F0FB9-C0B2-4682-B332-54F055FAC62F/sample_3840x2160_1080_33MB.MOV"
},
"url": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/8A5F0FB9-C0B2-4682-B332-54F055FAC62F/sample_3840x2160_1080_33MB.MOV",
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
}
},
"file": {
"name": "sample_3840x2160_1080_33MB.MOV",
"type": "video/quicktime",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/8A5F0FB9-C0B2-4682-B332-54F055FAC62F/sample_3840x2160_1080_33MB.MOV"
},
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
},
"receiver": "user",
"conversationId": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1_user_e28e352e-44eb-43ff-bdb8-1bce94748c22",
"_composedAt": 1639735415,
"_id": "_h87k1hg2i"
}
== sent, OK
5. 133MB, MOV
'{
"receiverId": "e28e352e-44eb-43ff-bdb8-1bce94748c22",
"type": "file",
"receiverType": "user",
"category": "message",
"data": {
"type": "file",
"category": "message",
"name": "sample_3840x2160.MOV",
"file": {
"name": "sample_3840x2160.MOV",
"type": "video/quicktime",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/2377522E-A152-4031-A183-C4A846F36398/sample_3840x2160.MOV"
},
"url": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/2377522E-A152-4031-A183-C4A846F36398/sample_3840x2160.MOV",
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
}
},
"file": {
"name": "sample_3840x2160.MOV",
"type": "video/quicktime",
"uri": "file:///var/mobile/Containers/Data/Application/B65CECFE-4707-4466-BB73-CFC4F819035E/Documents/2377522E-A152-4031-A183-C4A846F36398/sample_3840x2160.MOV"
},
"sender": {
"hasBlockedMe": false,
"blockedByMe": false,
"uid": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1",
"name": "StefanBusiness",
"authToken": "<<removed when creating this issue>>",
"lastActiveAt": 1639695446,
"role": "default",
"status": "online"
},
"receiver": "user",
"conversationId": "33926bf9-6a22-4d65-8bb4-5ede3a6b66c1_user_e28e352e-44eb-43ff-bdb8-1bce94748c22",
"_composedAt": 1639735498,
"_id": "_evue7ruec"
}'
== Error:
'{
"code": "ERR_BAD_REQUEST",
"message": "Failed to validate the data sent with the request.",
"details": {
"receiver": [
"The receiver field is required."
],
"receiverType": [
"The receiver type field is required."
]
}
}'
Could you advise us, on how to solve this issue, please? It’s affecting our production users.
Is there something we should do, or is the error happening on CometChat’s side, as we are experiencing this just by putting different input(files) into the same code?
I will also reach out @ help@cometchat.com.
Thank you very much,
Stefan