Every time a user uploads a picture we want to convert it to base64 for one of our integration partners.
The Javascript column caches and therefore is too unreliable, while Make ends up being too costly having to also pay for a coding module partner (like 1001fx).
Does anyone have any other ideas on how to do this?
I’m not aware of any other way, but one thing you could do is add a dummy parameter (eg. current timestamp) to the end of the image URL in the JavaScript when it is fetched. That might prevent any caching.
Note: I suspect that it isn’t the JavaScript column that is caching, but I’m guessing that you’re using the base64 string in a subsequent Call API action (?), and that’s more likely where the caching happens.
1 Like
The exact process follows >
- User uploads image, javascript column automatically runs off of that user’s upload (see script below).
- We have set column values to take what the script returns into a user tables non-computed column.
- We make a JSON Object in the action using that value.
- We call the API in the action using that object.
The script:
const getBase64FromUrl = async (url) => {
const data = await fetch(url);
const blob = await data.blob();
return new Promise((resolve) => {
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = () => {
const base64data = reader.result;
resolve(base64data);
}
});
}
return getBase64FromUrl(p1);
Yes, so my suggestion is to append the current timestamp to the image URL as a dummy parameter. This could be done either using a Template column, or within the JavaScript code itself.
2 Likes