nate
nate2y ago

uploading audio file

Hi, im generating an uplaod url
import {mutationWithUser} from './helpers/withUser';

export default mutationWithUser(async ({storage}) => {
return await storage.generateUploadUrl();
});
import {mutationWithUser} from './helpers/withUser';

export default mutationWithUser(async ({storage}) => {
return await storage.generateUploadUrl();
});
and then using rnfetchblob ~ https://www.npmjs.com/package/rn-fetch-blob#user-content-upload-example--dropbox-files-upload-api my files are uploading but the audiofile is not playable,. I've tried quite a bit, is there any specific config i should be setting up on the generate url?
9 Replies
Michal Srb
Michal Srb2y ago
Hey, is the file playable if you download it from your dashboard (Deployment > File Storage) and play it on your computer? Is it in the format you expect? This problem sounds unrelated to Convex, and more likely something to do with encoding on the write side or the player on the read side. Convex should be storing whatever bits you give it.
ian
ian2y ago
You might also inspect the content type headers used to upload / download and see if those match what you expect for the format. The download url content type should match the upload
nate
nateOP2y ago
the file is not playable in the dashboard it could be an issue on my end, it seems like its only uploading the path as a string as the size changes based on the string length if i send the file as form data the type never sticks in the file storage if i send it as an m4a it never plays
Michal Srb
Michal Srb2y ago
Definitely sounds like a problem with the upload code, mind sharing it? If I manually upload an m4a file to the dashboard I can download it and play it again.
Mordsith
Mordsith2mo ago
@Michal Srb I just happen to stumble accross this problem... At random times, m4a files never play, seeem like data corruption happens when it is sent from React Native app to Convex which is strange. The audio is generated from expo-audio
No description
No description
No description
Mordsith
Mordsith2mo ago
When I copy the same file from the generated audio in the file system and play, it works
No description
No description
Nicolas
Nicolas2mo ago
Hi @Mordsith! I tried to upload M4A files to the dashboard and play them and I had no issues. Could you please send me a file that has the issue?
Mordsith
Mordsith2mo ago
Hi @Nicolas When I upload the same generated file from the dashboard, it works fine I'm guessing the problem is from the FileSystem.uploadAsync function in code, I'm not sure. Discord is not allowing me upload the m4a file. I'll retry with multipart/form-data
Nicolas
Nicolas2mo ago
Thanks! I don't have the time to investigate the issue more at the moment unfortunately. Have you maybe tried to use another file storage provider (like AWS S3, Cloudflare R2, etc) to try to see if it’s a bug specific to Convex?

Did you find this page helpful?