Open jpaulgale opened 6 days ago
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 false
or true
from being passed to the dynamoDB properly π€
@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 /api/apps.datastore.query
because I'm seeing the same error using the SDK and CLI.
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 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 boolean
type, because a similar query using string
is successful.
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 https://github.com/slackapi/deno-slack-sdk/issues/385#issuecomment-2499119360, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLRK2ICY26NMHW652SBTF32COMOBAVCNFSM6AAAAABSKQO2R2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJZGEYTSMZWGA . You are receiving this because you were mentioned.Message ID: @.***>
Yes, ultimately my solution was to just use βtrueβ and βfalseβ strings
I noticed that as well π€ So, did the following command work when you treat "false"
as a string?
$ 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