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

kv:get errors out reading --preview key if key is not in JSON format #359

Closed
dukedorje opened this issue Feb 1, 2022 · 3 comments · Fixed by #360 or #350
Closed

kv:get errors out reading --preview key if key is not in JSON format #359

dukedorje opened this issue Feb 1, 2022 · 3 comments · Fixed by #360 or #350

Comments

@dukedorje
Copy link

Wrangler 0.0.15

Expected: kv:get returns the key requested
Actual: Errors out complaining that it's not JSON

yarn wrangler kv:key put oracleKey asdflkjsfad --binding pk --preview

yarn wrangler kv:key get oracleKey --binding pk --preview
Failed to fetch /accounts/6fxxxxxxxxxxxxxxx/storage/kv/namespaces/xxxxxxxxxxxxxxxxxx/values/oracleKey - 200: OK
Invalid JSON response:
asdflkjsfad
compatibility_date = "2022-02-01"
kv_namespaces = [ 
  { binding = "pk", id = "xxxxxxxxxxxx", preview_id = "xxxxxxxxxxxxxxxxx" }
]
@threepointone
Copy link
Contributor

Oh hmm I'd fixed this a while ago, but my fix got lost along the way. Will fix and add a test. Sorry about this!

threepointone added a commit that referenced this issue Feb 1, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case 'raw' requests to simply send the text through.
threepointone added a commit that referenced this issue Feb 1, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case 'raw' requests to simply send the text through.

Fixes #359.
threepointone added a commit that referenced this issue Feb 1, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case 'raw' requests to simply send the text through.

Fixes #359.
threepointone added a commit that referenced this issue Feb 1, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case 'raw' requests to simply send the text through.

Fixes #359.
threepointone added a commit that referenced this issue Feb 1, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case 'raw' requests to simply send the text through.

Fixes #359.
@dukedorje
Copy link
Author

🤘

threepointone added a commit that referenced this issue Feb 2, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case 'raw' requests to simply send the text through.

Fixes #359.
threepointone added a commit that referenced this issue Feb 2, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case for `kv:key get`.

Fixes #359.
threepointone added a commit that referenced this issue Feb 2, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case for `kv:key get`.

Fixes #359.
threepointone added a commit that referenced this issue Feb 2, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case for `kv:key get`.

Fixes #359.
threepointone added a commit that referenced this issue Feb 2, 2022
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the `FetchResult`-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case for `kv:key get`.

Fixes #359.
@threepointone
Copy link
Contributor

This is fixed in #360, we'll do a wrangler@beta release before the end of the week. you can try it now in wrangler@alpha. Thank you for reporting this!

GregBrimble pushed a commit that referenced this issue Feb 8, 2024
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
GregBrimble pushed a commit that referenced this issue Feb 9, 2024
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
GregBrimble pushed a commit that referenced this issue Feb 9, 2024
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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