When using kvPersist, it writes to disk by filename matching 1:1 with the entry key, keys with / included will write out a directory structure.
This means creating key like foo/bar creates a file .mf/kv/TEST_NAMESPACE/foo/bar, then also creating a key like foo will find .mf/kv/TEST_NAMESPACE/foo to already be a directory, and Node.js throws EISDIR: illegal operation on a directory.
This doesn't apply to a leading / as miniflare already translates it to _, e.g. in /hello-world. Other sanitization steps seems to do it as well, e.g. foo:bar and foo will do this as well.
Workers KV itself doesn't have this issue.
Minimal reproduction: https://github.com/kayteh/miniflare-kv-slash
In a real world example, one might use a few different keys to relate to each other loosely:
users/bob
users/bob/messages
When using kvPersist, it writes to disk by filename matching 1:1 with the entry key, keys with
/included will write out a directory structure.This means creating key like
foo/barcreates a file.mf/kv/TEST_NAMESPACE/foo/bar, then also creating a key likefoowill find.mf/kv/TEST_NAMESPACE/footo already be a directory, and Node.js throwsEISDIR: illegal operation on a directory.This doesn't apply to a leading
/as miniflare already translates it to_, e.g. in/hello-world. Other sanitization steps seems to do it as well, e.g.foo:barandfoowill do this as well.Workers KV itself doesn't have this issue.
Minimal reproduction: https://github.com/kayteh/miniflare-kv-slash
In a real world example, one might use a few different keys to relate to each other loosely:
users/bobusers/bob/messages