App Sheet image URL error caught in Apps Script

We encountered an image URL failure error in two scenarios in App Sheet:

First Case:

- Sometimes, duplicate images are created with the same file name, but one of them has a size of 0 KB.
- As a result, the image does not display in the app, and the App Sheet image URL with a signature cannot be used for inserting the image into Google slide when creating a presentation using Apps Script.
- When we paste the image URL into a browser, it returns an error in HTML format.
Please check the following error message and code:

Code:
Slides. Presentations. batch Update ({
      requests: requests
    }, copy. get Id());

"requests" array contains the create image requests for insert images in google slide.

Error:

 { [API call to slides. presentations. batch Update failed with error: Invalid requests[110].create Image: The provided image was not found.]
  details:
   { code: 400,
     message: 'Invalid requests[110].create Image: The provided image was not found.' } }

Second Case:

- This issue occurs when fetching images using the fetch All method to retrieve image blobs.
In this case, the image URLs open correctly in a browser, and images are displayed in the app. - Also status code of image URL is 200.

Please check the following error message and code:

Code:

const image_blob_array = URL Fetch App. fetch All(images_URLs);
"images URLs" is an array of app sheet image URLs.

Error:

 { [: API call to slides. presentations. batch Update failed with error: Invalid requests[87].create Image: There was a problem retrieving the image. The provided image should be publicly accessible, within size limit, and in supported formats.]
  name: 'Google Response Exception',
  details:
   { code: 400,
     message: 'Invalid requests [87].create Image: There was a problem retrieving the image. The provided image should be publicly accessible, within size limit, and in supported formats.' } }

Anybody know a solution for this?

Thanks in advance.

0 1 87
1 REPLY 1