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

[Bug] Can't add search attribute to Workflow run #292

Open
bmorton opened this issue Sep 28, 2022 · 2 comments
Open

[Bug] Can't add search attribute to Workflow run #292

bmorton opened this issue Sep 28, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@bmorton
Copy link

bmorton commented Sep 28, 2022

What are you really trying to do?

I have a search attribute defined as ObjectID, but when I try to start a Workflow with it, I get a JSON parse error. The other parameters don't seem to impact this. I can start this Workflow programmatically with the SDK fine, so this seems to be isolated to the CLI and how it parses this input.

❯ TEMPORAL_CLI_SHOW_STACKS=1 tctl workflow run --search_attr_key 'ObjectID' --search_attr_value '02fd0862-2c72-4115-a8d6-4efd9fbcdd43' --taskqueue TEST --workflow_type test
Error: Search attribute JSON parse error.
Error Details: invalid character '2' after top-level value
Stack trace:
goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x68
runtime/debug.PrintStack()
	runtime/debug/stack.go:16 +0x20
github.com/temporalio/tctl/cli_curr.printError({0x105652bd6, 0x22}, {0x1060416f8, 0x140000d8780})
	github.com/temporalio/tctl/cli_curr/util.go:392 +0x1d0
github.com/temporalio/tctl/cli_curr.ErrorAndExit({0x105652bd6?, 0x24?}, {0x1060416f8?, 0x140000d8780?})
	github.com/temporalio/tctl/cli_curr/util.go:403 +0x2c
github.com/temporalio/tctl/cli_curr.unmarshalSearchAttrFromCLI(0x1400023d8c0)
	github.com/temporalio/tctl/cli_curr/workflowCommands.go:327 +0x1fc
github.com/temporalio/tctl/cli_curr.startWorkflowHelper(0x1400023d8c0, 0x1)
	github.com/temporalio/tctl/cli_curr/workflowCommands.go:217 +0x258
github.com/temporalio/tctl/cli_curr.RunWorkflow(...)
	github.com/temporalio/tctl/cli_curr/workflowCommands.go:178
github.com/temporalio/tctl/cli_curr.newWorkflowCommands.func4(0x140003b82f0?)
	github.com/temporalio/tctl/cli_curr/workflow.go:65 +0x24
github.com/urfave/cli.HandleAction({0x105c00f00?, 0x10603b5b8?}, 0x3?)
	github.com/urfave/[email protected]/app.go:526 +0x5c
github.com/urfave/cli.Command.Run({{0x105606568, 0x3}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x10569004b, 0x38}, {0x0, ...}, ...}, ...)
	github.com/urfave/[email protected]/command.go:173 +0x540
github.com/urfave/cli.(*App).RunAsSubcommand(0x14000836000, 0x1400023d080)
	github.com/urfave/[email protected]/app.go:405 +0x6ec
github.com/urfave/cli.Command.startApp({{0x1056109c7, 0x8}, {0x0, 0x0}, {0x140003fa8f0, 0x1, 0x1}, {0x105637fda, 0x19}, {0x0, ...}, ...}, ...)
	github.com/urfave/[email protected]/command.go:372 +0x698
github.com/urfave/cli.Command.Run({{0x1056109c7, 0x8}, {0x0, 0x0}, {0x140003fa8f0, 0x1, 0x1}, {0x105637fda, 0x19}, {0x0, ...}, ...}, ...)
	github.com/urfave/[email protected]/command.go:102 +0x698
github.com/urfave/cli.(*App).Run(0x140000d7500, {0x140001b0000, 0xb, 0xb})
	github.com/urfave/[email protected]/app.go:277 +0x620
main.main()
	./main.go:45 +0xc8

Describe the bug

It looks like it expects the value to be JSON, but this is just a string to be used as a keyword. It's possible that I'm formatting it incorrectly, but I'm following the docs at: https://docs.temporal.io/tctl/workflow/run/

Minimal Reproduction

I don't think you need an environment running to reproduce this. This seems to trigger it:

tctl workflow run --search_attr_key 'ObjectID' --search_attr_value '02fd0862-2c72-4115-a8d6-4efd9fbcdd43' --taskqueue TEST --workflow_type test

Environment/Versions

  • OS and processor: M1 Mac
  • Temporal Version: tctl 1.16.2
  • Are you using Docker or Kubernetes or building Temporal from source? Docker
@feedmeapples
Copy link
Contributor

feedmeapples commented Oct 11, 2022

could you try passing as JSON which would be --search_attr_value '\"02fd0862-2c72-4115-a8d6-4efd9fbcdd43\"'

I'll keep the issue open and update the error message so it helps better

@bmorton
Copy link
Author

bmorton commented Oct 18, 2022

That produces a slightly different error message for me:

❯ tctl workflow run --search_attr_key 'ObjectID' --search_attr_value '\"02fd0862-2c72-4115-a8d6-4efd9fbcdd43\"' --taskqueue TEST --workflow_type test
Error: Search attribute JSON parse error.
Error Details: invalid character '\\' looking for beginning of value
('export TEMPORAL_CLI_SHOW_STACKS=1' to see stack traces)

But just tried this and this works (I'm using zsh if that makes the difference):

tctl workflow run --search_attr_key 'ObjectID' --search_attr_value '"02fd0862-2c72-4115-a8d6-4efd9fbcdd43"' --taskqueue TEST --workflow_type test

Thanks for the reply! I should be good from here, but I'm worried this issue will come up with my team so an updated error message would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants