Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError thrown while put empty string with KV #703

Closed
mayocream opened this issue Oct 4, 2023 · 3 comments · Fixed by #704
Closed

AssertionError thrown while put empty string with KV #703

mayocream opened this issue Oct 4, 2023 · 3 comments · Fixed by #704

Comments

@mayocream
Copy link

mayocream commented Oct 4, 2023

Hi, I am getting an assert error when using wrangler dev to test locally. According to docs, it should be ok to put "" value.

Example code:

await env.KV.put(`user:${id}`, '', { metadata })

Error thrown:

[mf:err] AssertionError: false undefined true
    at new AssertionError (node-internal:internal_assertionerror:419:15)
    at assert (node-internal:internal_assert:48:15)
    at KVNamespaceObject.put (/Users/mayo/Library/pnpm/global/5/.pnpm/miniflare@3.20230922.0/node_modules/miniflare/src/workers/kv/namespace.worker.ts:131:5)
    at KVNamespaceObject.fetch (/Users/mayo/Library/pnpm/global/5/.pnpm/miniflare@3.20230922.0/node_modules/miniflare/src/workers/shared/router.worker.ts:42:54)
    at KVNamespaceObject.fetch (/Users/mayo/Library/pnpm/global/5/.pnpm/miniflare@3.20230922.0/node_modules/miniflare/src/workers/shared/object.worker.ts:132:26)

However, when I change it to put a non-empty string, it works correctly.

Environment: "wrangler": "3.10.1"

mrbbot added a commit that referenced this issue Oct 5, 2023
Empty `put()`s may send HTTP requests with `null` bodies, violating
an assumption we had. This change handles this case, and adds some
additional tests for empty values.

Closes #703
@mrbbot
Copy link
Contributor

mrbbot commented Oct 5, 2023

Hey! 👋 Thanks for reporting this! I've put a fix up (#704), which should be released soon. 👍

@mrbbot mrbbot linked a pull request Oct 5, 2023 that will close this issue
@mayocream
Copy link
Author

Hey! 👋 Thanks for reporting this! I've put a fix up (#704), which should be released soon. 👍

Super thanks for the quick response! will wait for the next release! 👏

mrbbot added a commit that referenced this issue Oct 5, 2023
Empty `put()`s may send HTTP requests with `null` bodies, violating
an assumption we had. This change handles this case, and adds some
additional tests for empty values.

Closes #703
@mrbbot
Copy link
Contributor

mrbbot commented Nov 7, 2023

Fixed in miniflare@3.20231002.1 and above 👍

@mrbbot mrbbot closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants