Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

KV keys with / with kvPersist throws EISDIR #167

Description

@mekanoe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestv3-fixedFixed in V3, will be closed soon

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions