Missing User or UserId field in QueryPollsRequest model

Open
#9 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp
Domain
api

Research direction

Start by locating the QueryPollsRequest model and the QueryPollsAsync entry point, then compare their supported fields with the server-authentication error. Verify that user or user_id can be supplied through the request and serialized into the query. Reproduce the reported call and confirm it succeeds without the 400 error.

Written by the indexing model from the issue text.

Description

When trying to query polls, I get an error indicating that I need to provide user or user_id because I'm using server authentication.
I've tried adding the user or user_id in the Filter object, but I didn't have luck.

My code

StreamResponse<PollResponse> poll = await client.CreatePollAsync(new CreatePollRequest()
{
    UserID = "SampleUserId",
    AllowAnswers = true,
    Name = "Give us feedback",
    Options = [new PollOptionInput() { Text = "Very disatisfied" }, new PollOptionInput() { Text = "Dissatisfied" }, new PollOptionInput() { Text = "Average" }, new PollOptionInput() { Text = "Satisfied" }, new PollOptionInput() { Text = "Very satisfied" }],

});

StreamResponse<QueryPollsResponse> existingPoll = await client.QueryPollsAsync(new QueryPollsRequest() // error happens here
{
    Filter = new Dictionary<string, string>()
    {
        { "name", "Give us feedback" },
        { "user", "SampleUserId" }
    },
    Limit = 2
});

Observation

I recieve the following error when using QueryPollsAsync()

GetStream.GetStreamApiException: 'HTTP BadRequest: {"code":4,"message":"QueryPolls failed with error: \"either user or user_id must be provided when using server side auth.\"","StatusCode":400,"duration":"0.00ms","more_info":"https://getstream.io/chat/docs/api_errors_response","details":[]}'

Expectation

I expect to be able to provide the user or user_id through the library

Environment

SDK: getstream-net 2.1.0
.NET: 9.0

cc @itsmeadi

Dominant language
C#
Stars
2
Forks
0
Avg merge
6h 55m
Merged PRs (30d)
19

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GetStream/getstream-net

All issues in GetStream/getstream-net

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.