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

[BUG] KV deserialization broke between worker 0.0.13 and 0.0.17 (worker-kv 0.5 and 0.6) #356

Open
1 task done
awaitlink opened this issue Jul 16, 2023 · 0 comments
Open
1 task done

Comments

@awaitlink
Copy link

awaitlink commented Jul 16, 2023

Is there an existing issue for this?

  • I have searched the existing issues

What version of workers-rs are you using?

0.0.17

What version of wrangler are you using?

3.2.0

Describe the bug

The project at https://github.com/u32i64/signalupdates-bot/tree/dcc4abc965913174bc0480b56e67ff035f62426f compiles and deploys successfully, however trying to run it causes the following error when reading state from KV that looks like this:

{
  "android": {
    "last_posted_tag_previous_release": {
      "name": "..."
    },
    "last_posted_tag": {
      "name": "..."
    },
    "last_post": {
      "id": 123456,
      "number": 123
    },
    "posted_archiving_message": true,
    "localization_changes_completeness": "Incomplete",
    "localization_changes": {
      "kk": [
        "Main"
      ],
    },
    "pending_state": null
  },
  "desktop": { /* ... */ },
  "ios": { /* ... */ }
}
ERROR signalupdates_bot: error=could not get value for key state

Caused by:
    js error: JsValue(Error: invalid type: string "kk", expected a borrowed string
    Error: invalid type: string "kk", expected a borrowed string
        at ct (shim.js:369:11)
        at wasm://wasm/00e8ef02:wasm-function[812]:0x103639
        at wasm://wasm/00e8ef02:wasm-function[1076]:0x1357cf
        at wasm://wasm/00e8ef02:wasm-function[149]:0x542ce
        at wasm://wasm/00e8ef02:wasm-function[126]:0xdb86
        at wasm://wasm/00e8ef02:wasm-function[294]:0xb637c
        at wasm://wasm/00e8ef02:wasm-function[462]:0xe0076
        at wasm://wasm/00e8ef02:wasm-function[1782]:0x145b24
        at tt (shim.js:141:5)
        at b (shim.js:127:14))

I suspect the issue is with the deserialization of the Language struct.

I tried setting try_from = "String" and providing a corresponding impl, that did not fix the issue.

The "solution" was downgrading worker-kv and then downgrading worker until the project builds (awaitlink/signalupdates-bot@d46e6a4). After that the project deploys and deserializes the state successfully.

Considering the downgrade affected serde-wasm-bindgen, could be that the issue is in https://github.com/cloudflare/serde-wasm-bindgen.

Steps To Reproduce

No response

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

No branches or pull requests

1 participant