I have a website on which I can fetch data through APIs to my database. But for like 2 weeks I have had an error sometimes when I fetch in APIs, which is: ERR_SSL_BAD_RECORD_MAC_ALERT
. But only when fetching data a little bit with more payload. But, before, I did not get this error, expect when fetching IMGs, that is resolved thanks to vercel blob.
I tested to host my project on netlify, and I have not this error anymore, nevermind I try to fetch like 100000 times, no error. Only on vercel.
Maybe it’s only for me, bc I read that is can be caused by hardware or software of the client. Here u can test, try to import a large image (like 1.5mb), and tell me if u get the error in the console: Authentification
Also, when I didn’t use blob, I could compress my img before convert to base64. But now, I have the intuition that they are not compressed anymore, and I don’t know how to do it with blob. Here is my code for fetching in blob:
const handleUpload = async (e) => {
const reader = new FileReader()
const file = inputFileRef.current.files[0];
new Compressor(file, {quality: 0.1, width: 200, height: 200, success(result) {
reader.onload = async (event) => {
const response = await fetch(
`/api/upload?filename=${result.name}`,
{
method: 'POST',
},
);
if (!response.ok) {
toast.error(response.message)
return
}
else {
const newBlob = await response.json();
setImg(newBlob.blob.url)
}
}
reader.onerror = (err) => {
toast.error(`Erreur lors de l'upload de l'image: ${err}`)
}
}})
}
I don’t rlly understand how blob works, and I don’t know if result.name
is enough for blob to know that it’s compressed ?
I want to add that when adding an img in my blob, et get a timeout with vercel hosting and just bad gateway on netlify hosting (which I didn’t get in the past, just after completing the blob: it worked, but not anymore)