cli icon indicating copy to clipboard operation
cli copied to clipboard

Blob etag is undefined in edge function but changes each time the store is output as a list

Open Shotster opened this issue 1 year ago • 0 comments

Describe the bug

I’ve been experimenting with blobs as a programmable cache as described in this Netlify blog post.

If I inspect the stored blob's etag (by outputting it in a header for instance), the value is always undefined. If, however, I list the contents of the store (which contains just the single blob), then the etag for the same stored blob changes with each request.

I'd expect the etag to be always present and unchanging until a new version of the resource is stored. It works as expected when deployed.

Steps to reproduce

Here’s the code executed with each request after the blob has already been stored…

const myCache = getStore('my-cache')
const cacheInfo =  await myCache.list()
console.log( cacheInfo.blobs )

And here’s the output of my edge function named “transform” after 3 consecutive requests (without modifying the store or updating the blob)…

[transform] [ { etag: "19805199838756904", key: "my-key" } ]
[transform] [ { etag: "7045868894520977", key: "my-key" } ]
[transform] [ { etag: "31968353280310935", key: "my-key" } ]

The etag is different with each request. It works as expected when deployed to Netlify.

Configuration

No response

Environment

  System:
    OS: macOS 15.0.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 5.92 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.2.0 - ~/.nvm/versions/node/v22.2.0/bin/node
    Yarn: 1.3.2 - /usr/local/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v22.2.0/bin/npm
  npmGlobalPackages:
    netlify-cli: 17.37.1

Shotster avatar Oct 28 '24 02:10 Shotster