if (files) {
// username and slug are existing values in code.
bucket = `${username}/${slug}`;
await files.forEach(async (file, i) => {
const imageFilename = `${name}-${i}-${Math.random()}`;
const imageURL = `${supabaseUrl}/storage/v1/object/public/${stylistBucket}/${imageFilename}`;
images.push(imageURL);
const { error: imageUploadError } = await sbAdmin.storage
.from(stylistBucket)
.upload(imageFilename, file, {
cacheControl: "3600", // tried also removing these options but no changes were noticable in this strange behavior
upsert: false,
});
if (imageUploadError) {
console.error(imageUploadError);
throw new Error(imageUploadError)
});
}
// everything was working well until yesterday with this same code.
if (files) {
// username and slug are existing values in code.
bucket = `${username}/${slug}`;
await files.forEach(async (file, i) => {
const imageFilename = `${name}-${i}-${Math.random()}`;
const imageURL = `${supabaseUrl}/storage/v1/object/public/${stylistBucket}/${imageFilename}`;
images.push(imageURL);
const { error: imageUploadError } = await sbAdmin.storage
.from(stylistBucket)
.upload(imageFilename, file, {
cacheControl: "3600", // tried also removing these options but no changes were noticable in this strange behavior
upsert: false,
});
if (imageUploadError) {
console.error(imageUploadError);
throw new Error(imageUploadError)
});
}
// everything was working well until yesterday with this same code.