R2 public bucket 404

I’ve got a bucket set to allow public access and connected to a subdomain.

I use aws-sdk to upload images to the bucket using the following code:

app.post('/upload2, MuiltiPartyMiddleware, async (req, res) => {
const TempFile = req.files.upload
const p = ‘media/frettamyndir2/’

const promise = fs.promises.readFile(path.join(TempFile.path))

const imageBuffer = await Promise.resolve(promise)

try {
var params = {
Bucket: ‘blika-static’,
Key: TempFile.originalFilename,
Body: imageBuffer,

s3.upload(params, (err, data) => {
  console.log(err, data)

const link = 'https://static.blika.is/'+TempFile.originalFilename
res.status(200).send({ uploaded: true, url: link })

} catch (error) {

The image is sucessfully uploaded as hown on the Cloudflare dashboard, and I can download it from there, but whenever I try to access it from the subdomain via subdomain/filename it gives me a 404 error that says You are not authorized to view this object.

The weird thing is that sometimes it works, but other times I get the 404 error. Any idea what could be causing this?

hey sveinngauti, I also encounter this issue. Any update?