Skip to content

[Bug] Cannot set Custom Reward is_paused field to false #326

@TulioAbreu

Description

@TulioAbreu

What is the problem?

I just found recently that Twitch had this mock api for testing requests without me needing to be a partner. While testing my integration, I found that I could not change Custom Rewards boolean field is_paused to false. I can set it to true, but not the inverse.

I'm not familiarized with Golang, but tried to investigate the source code and found this code snippet, that may be related:
https://github.com/twitchdev/twitch-cli/blob/main/internal/database/sql_gen.go#L192C8-L194

		case bool:
			if !f {
				continue
			}

I may test it later, but from my quick view, this means that falsy f are ignored on update clause, right? Just as zero is ignored on integer clauses

Operating System

Windows WSL

Architecture Version (x86, x64, arm, etc)

x86

Steps to reproduce

  1. Setup and start mock-api
  2. Send an update (PATCH) request to /channel_points/custom_rewards changing the boolean field is_paused

When passing a true value, the request works and update the custom reward is_paused field. However, when we try to set this field as false, it does not happen. Here's a curl request:

curl 'http://localhost:3000/api/mock/channel_points/custom_rewards?broadcaster_id=36028131&id=a2279f06-0856-213d-02ba-99c9d2041cb6'   -X 'PATCH'   -H 'Accept: application/json, text/plain, */*'   -H 'Accept-Language: pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7'   -H 'Authorization: Bearer a87ee147eaa5469'   -H 'Client-Id: 9607c0f8e0f2a957877be84be7e21c'   -H 'Connection: keep-alive'   -H 'Content-Type: application/json'   -H 'DNT: 1'   -H 'Origin: http://localhost:3000'   -H 'Referer: http://localhost:3000/custom-rewards'   -H 'Sec-Fetch-Dest: empty'   -H 'Sec-Fetch-Mode: cors'   -H 'Sec-Fetch-Site: same-origin'   -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'   -H 'sec-ch-ua: "Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"'   -H 'sec-ch-ua-mobile: ?0'   -H 'sec-ch-ua-platform: "Windows"'   --data-raw '{"is_paused":false}'

There's no error log, it will just return me the payload containing a custom reward with is_paused: true

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions