#uuidv4 is not defined only on second run of file

1 messages · Page 1 of 1 (latest)

merry dove
#

That title will not do this question justice.

I have an application that uses the filepicker. The onFileSelected trigger calls a function uploadImage, which is supposed to generate a uuid via https://unpkg.com/[email protected]/dist/umd/uuidv4.min.js, and insert the image into an S3 bucket. This was all working fine before the most recent release of v1.8.5.

Now, however, the function executes fine on the first run, but if you want to upload another image using the same function, it throws an error: "Uncaught Promise Rejection: uuidv4 is not defined".

Why would it suddenly stop working? Was there something in 1.8.5 that might have broken this admittedly janky implementation?

The function:

uploadImage: async function(fileInput, query) {
  // If no fileInput is defined it's likely that this function
  // has been call by appsmith to determine if it is async.
  // This call should be ignored
  if (!fileInput) return null;
        
  if (fileInput.files.length !== 1) {
    throw new Error("Error: More than one image passed to file uploader")
    return null;
  }
        
  if(typeof uuidv4 !== 'function') {
    await import("https://unpkg.com/[email protected]/dist/umd/uuidv4.min.js");
  } 
        
   const file = fileInput.files[0];
   const extension = file.name.split('.').pop();
        
    const id = uuidv4();
    const name = `${id}.${extension}`;
    await query.run({ name, file });
  }
halcyon ingotBOT
#

Appsmith doesn't currently support importing external libraries, but we have an
open feature request here that we're currently working on. Please comment your
use case and keep an eye out here for the progress of the feature:

https://github.com/appsmithorg/appsmith/issues/2430

GitHub

Summary Import additional JS libraries that I can use. Creating this issue as a placeholder Support CDN based and JS SDK List of library support requested by users jsPDF https://www.npmjs.com/packa...

merry dove
#

^ N/A

halcyon ingotBOT
#

Is this issue not applicable here?

merry dove
#

no

halcyon ingotBOT
merry dove
#

It DID work as of 1.8.4, though. It's janky but it was fully functional. Im trying to generate a uuid.

#

It just STOPPED working at almost the exact time when 1.8.5 was released