-
Notifications
You must be signed in to change notification settings - Fork 30
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] Datastore not allowing me to query by boolean field. #385
Comments
Hi @jpaulgale thanks for writing 💯 I was able to reproduce this behavior, but I think this may be an issue with the CLI and not the SDK I suspect some sort of JSON conversion is preventing boolean values like @mwbrooks would you be able to confirm if this is a CLI issue? |
Thanks for tagging me @WilliamBergamin 🙇🏻 and big props to @jpaulgale for the code samples 👌🏻 I was also able to reproduce the issue. 🎉 I think this a Slack API issue with Slack CLI: Using the $ slack datastore query '{ "datastore": "kudos_data", "expression": "#shared = :false_value", "expression_attributes": {"#shared": "shared_on_channel"}, "expression_values": {":false_value": false} }' --verbose
# [2024-11-25 13:31:44] HTTP Request: POST https://slack.com/api/apps.datastore.query HTTP/1.1
# HTTP Request Body:
# {"datastore":"kudos_data","app_id":"A082EED55SP","expression":"#shared = :false_value","expression_attributes":
# {"#shared":"shared_on_channel"},"expression_values":{":false_value":false}}
# [2024-11-25 13:31:45] HTTP Response Status: HTTP/1.1 200 OK
# HTTP Response Body:
# {"ok":false,"error":"datastore_error","errors":[{"code":"datastore_query_error","message":"InternalServerError: An
# InternalServerError occurred","pointer":"\/datastore\/kudos_data"}]} Slack Deno SDK: I tried Datastore Query using SDK by adding it to a Workflow Function and I receive a similar API Error when I view the activity logs: const result = await client.apps.datastore.query({
"datastore": "kudos_data",
"expression": "#shared = :false_value",
"expression_attributes": { "#shared": "shared_on_channel" },
"expression_values": { ":false_value": false },
});
console.log("Datastore Query Result:");
console.log(result); $ slack activity -t
# 2024-11-25 13:46:13 [error] [Datastore:kudos_data] (Trace=Tr082EGB0KSP) Datastore query failed with
# '{"expression":"#shared = :false_value","expression_attributes":{"#shared":"shared_on_channel"},"expression_values":
# {":false_value":false},"limit":100,"cursor":""}'
#
# InternalServerError: An InternalServerError occurred
#
# Datastore Query Result:
# {
# toFetchResponse: [Function: toFetchResponse],
# ok: false,
# error: "datastore_error",
# errors: [
# {
# code: "datastore_query_error",
# message: "InternalServerError: An InternalServerError occurred",
# pointer: "/datastore/kudos_data"
# }
# ]
# } @WilliamBergamin I think we'll have to look into the server-side logs to understand more. I think you're correct that the issue is related to the |
Yes, ultimately my solution was to just use “true” and “false” strings,
which aside from the time I spent trying to get the Boolean query to work,
works just as well for my purposes
…On Mon, Nov 25, 2024 at 4:57 PM Michael Brooks ***@***.***> wrote:
Thanks for tagging me @WilliamBergamin
<https://github.com/WilliamBergamin> 🙇🏻 and big props to @jpaulgale
<https://github.com/jpaulgale> for the code samples 👌🏻
I was also able to reproduce the issue. 🎉
I think this a Slack API issue with /api/apps.datastore.query
<https://api.slack.com/methods/apps.datastore.query>.
*Slack CLI:*
Using the --verbose flag, it looks like the CLI is parsing the query
correctly based on the API Request Body and the API Response is an
InternalServerError:
$ slack datastore query '{ "datastore": "kudos_data", "expression": "#shared = :false_value", "expression_attributes": {"#shared": "shared_on_channel"}, "expression_values": {":false_value": false} }' --verbose
# [2024-11-25 13:31:44] HTTP Request: POST https://slack.com/api/apps.datastore.query HTTP/1.1# HTTP Request Body:# {"datastore":"kudos_data","app_id":"A082EED55SP","expression":"#shared = :false_value","expression_attributes": # {"#shared":"shared_on_channel"},"expression_values":{":false_value":false}}
# [2024-11-25 13:31:45] HTTP Response Status: HTTP/1.1 200 OK# HTTP Response Body:# {"ok":false,"error":"datastore_error","errors":[{"code":"datastore_query_error","message":"InternalServerError: An # InternalServerError occurred","pointer":"\/datastore\/kudos_data"}]}
*Slack Deno SDK:*
I tried Datastore Query using SDK
<https://api.slack.com/automation/datastores-retrieve#query> by adding it
to a Workflow Function and I receive a similar API Error when I view the
activity logs:
const result = await client.apps.datastore.query({
"datastore": "kudos_data",
"expression": "#shared = :false_value",
"expression_attributes": { "#shared": "shared_on_channel" },
"expression_values": { ":false_value": false },
});
console.log("Datastore Query Result:");
console.log(result);
$ slack activity -t
# 2024-11-25 13:46:13 [error] [Datastore:kudos_data] (Trace=Tr082EGB0KSP) Datastore query failed with # '{"expression":"#shared = :false_value","expression_attributes":{"#shared":"shared_on_channel"},"expression_values":# {":false_value":false},"limit":100,"cursor":""}'# # InternalServerError: An InternalServerError occurred# # Datastore Query Result:# {# toFetchResponse: [Function: toFetchResponse],# ok: false,# error: "datastore_error",# errors: [# {# code: "datastore_query_error",# message: "InternalServerError: An InternalServerError occurred",# pointer: "/datastore/kudos_data"# }# ]# }
@WilliamBergamin <https://github.com/WilliamBergamin> I think we'll have
to look into the server-side logs to understand more. I think you're
correct that the issue is related to the boolean type, because a similar
query using string is successful.
—
Reply to this email directly, view it on GitHub
<#385 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLRK2ICY26NMHW652SBTF32COMOBAVCNFSM6AAAAABSKQO2R2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJZGEYTSMZWGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I noticed that as well 🤔 So, did the following command work when you treat $ slack datastore query '{ "datastore": "kudos_data", "expression": "#shared = :false_value", "expression_attributes": {"#shared": "shared_on_channel"}, "expression_values": {":false_value": "false"} }' |
Yes, works just fine |
The
deno-slack
versionsDeno runtime version
OS info
Describe the bug
Datastore is not allowing me to query by a boolean field.
Steps to reproduce
Here is the datastore file
And the contents of that datastore
Expected result
I expect a query for
shared_on_channel = false
to return all three recordsActual result
When I try to filter by
"shared_on_channel" = false
The text was updated successfully, but these errors were encountered: