Assets in bucket folder renamed on upload

There’s this weird behavior where asset names are changed during upload after which in production they can’t be matched with hrefs/src pages requesting them. Theres a hash added before file extension/format, I suspect it has to do with the idea that CI/CD uploads new versions, but I’d rather files in that folder would just get overwritten as there are currently several versions of those files in that binding/store/bucket. Did I miss a param in [site] section of wrangler.toml that dictates that assets replace each other and retain the same name?

1 Like

Also running into this issue with modules workers. Workaround is to define a separate workers project and share KV namespace with static assets and manifest.

Also related:

EDIT: If you’re interested in an alternative hacky solution, you could parse out the path name, perform a KV namespace list to search for the prefix, and manually assign the MIME types back in afterwards

EDIT2: Okay- figured it out. When running within miniflare, the __STATIC_CONTENT_MANIFEST attribute will exist inside the env object. When deployed, env does not contain __STATIC_CONTENT_MANIFEST and you need to import it. Don’t do the hacky list KV approach

1 Like

I’m not using export {fetch: ()=>()} format which is what modules should be, but I’ll just assume this bug applies to everything.Can you post your manifest @uda? I can’t tell what it should look like.

The manifest is generated for you by Wrangler on publish. My source code is available here:
https://git.sr.ht/~udia/meta.udia.ca/tree/6c513d4d51c6e322b73da09c7d5ce3d908c51f06

The value of import manifest from '__STATIC_CONTENT_MANIFEST' in my deployed worker is

"{\"entry.client.js.map\":\"entry.client.js.c61d7e0b6f.map\",\"favicon.ico\":\"favicon.252711128e.ico\",\"entry.client.js\":\"entry.client.4895e94cc5.js\"}"

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.