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

Decoding fails when there is no cryptconverter.PropagateKey in the cryptconverter sample #117

Open
ghstahl opened this issue Jul 8, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ghstahl
Copy link

ghstahl commented Jul 8, 2021

I want to be able to selectively decide if my workflow is to have its payloads encrypted. I am using the following sample project as a starter to prove I can do it.
samples-go/cryptconverter at master · temporalio/samples-go (github.com)

The following code is where I am focusing in on.

ctx := context.Background()
//ctx = context.WithValue(ctx, cryptconverter.PropagateKey, cryptconverter.CryptContext{KeyId: "test"})

// The workflow input "My Secret Friend" will be encrypted by the DataConverter before being sent to Temporal
we, err := c.ExecuteWorkflow(
  ctx,
  workflowOptions,
  cryptconverter.Workflow,
  "My Secret Friend",
  )

It should be easy as not putting in the the following;

ctx = context.WithValue(ctx, cryptconverter.PropagateKey, cryptconverter.CryptContext{KeyId: "test"})

The code in the sample does account for it not being there but I am running into a json.Unmarshal error when I remove it.

{
  "message": "unable to decode the workflow function input payload with error: args[0]: unable to decode: json: cannot unmarshal array into Go value of type string, function name: Workflow",
  "source": "GoSDK",
  "stackTrace": "",
  "cause": {
    "message": "args[0]: unable to decode: json: cannot unmarshal array into Go value of type string",
    "source": "GoSDK",
    "stackTrace": "",
    "cause": {
      "message": "unable to decode: json: cannot unmarshal array into Go value of type string",
      "source": "GoSDK",
      "stackTrace": "",
      "cause": {
        "message": "unable to decode",
        "source": "GoSDK",
        "stackTrace": "",
        "cause": null,
        "applicationFailureInfo": {
          "type": "",
          "nonRetryable": false,
          "details": null
        },
        "failureInfo": "applicationFailureInfo"
      },
      "applicationFailureInfo": {
        "type": "wrapError",
        "nonRetryable": false,
        "details": null
      },
      "failureInfo": "applicationFailureInfo"
    },
    "applicationFailureInfo": {
      "type": "wrapError",
      "nonRetryable": false,
      "details": null
    },
    "failureInfo": "applicationFailureInfo"
  },
  "applicationFailureInfo": {
    "type": "wrapError",
    "nonRetryable": false,
    "details": null
  },
  "failureInfo": "applicationFailureInfo"
}

In summary, I simply commented out the line that puts the cryptconverter.PropagateKey into the ExecuteWorkflow context.

@ghstahl ghstahl added the bug Something isn't working label Jul 8, 2021
@robholland
Copy link
Contributor

Sorry for not seeing this sooner. I can't replicate this with the current version, can you confirm if this still occurs?

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