Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-9045

Using the node js client, a date variable cannot be deserialized

XMLWordPrintable

    • Icon: Bug Report Bug Report
    • Resolution: Fixed
    • Icon: L3 - Default L3 - Default
    • 7.9.0
    • None
    • None

      Steps to reproduce:

      1. deploy a process with a external task (with topic name foo)
      2. start an instance and pass a variable bar from type date
      3. subscribe to the topic foo
        client.subscribe("foo", function({ task, taskService }) {
          const dateValue = task.variables.get('bar');
          ...
        });
        

      Actual Behavior:

      • the handler is not invoked
      • the deserialization of the date variable fails with following exception:
        ✖ polling failed with TypeError: value.toISOString is not a function
        

      Expected Behavior:

      • the date variable is deserialized properly and a date is returned
      • the handler is always invoked, the deserialization of the variable happens only, when the user tries to get the variable

      Additional:
      The documentation [1] says, that dates are always available in the string format, which might be confusing, when someone does the following:

      client.subscribe("foo", function({ task, taskService }) {
        const variables = new Variables();
        variables.set('dateValue', new Date());
      
        const dateValue = variables.get('dateValue'); // <-- returns a date object
        ...
      });
      

      There should be just one way, how a date variable is deserialized.

      [1]: https://github.com/camunda/camunda-external-task-client-js/blob/master/docs/Variables.md#date

        This is the controller panel for Smart Panels app

              michael.schoettes Michael Schoettes
              roman.smirnov Roman Smirnov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: